Black Friday Our biggest deal of the year is coming soon Get notified →

Connect Using OpenConnect on macOS

Updated 4 Oct 2026 3 min read

This guide shows you how to connect a Mac to PremierVPN with OpenConnect, a free command-line client that works with AnyConnect servers. It connects over port 443, so it often works on networks that block other VPN types.

Prefer not to use Terminal? The PremierVPN app for Mac signs in with your portal email and password, and macOS also has built-in IKEv2: see Connect using IKEv2 on macOS.

Before you start: use your VPN credentials

Manual setups sign in with your VPN username and VPN password. These are separate from the email and password you use for the portal and the PremierVPN apps, and the portal login will not work here.

  • Find both on your Dashboard under Your VPN credentials. Click Show to reveal the password.
  • To change the VPN password, go to Settings › VPN Password. The new password applies from your next connection.
  • Not sure which login is which? See Understanding your VPN credentials.

Install OpenConnect

Install it with Homebrew. If you don't have Homebrew yet, install it first by following the instructions on its website. Then run:

brew install openconnect

Connect

Run this in Terminal, replacing YOUR_VPN_USERNAME with the VPN username from your Dashboard:

sudo openconnect --user=YOUR_VPN_USERNAME uk.premiervpn.net
  1. Enter your Mac's login password first (this is for sudo).
  2. Then enter your VPN password when OpenConnect asks for it.
  3. Leave the Terminal window open while you use the VPN. Press Ctrl+C to disconnect.

To use a different location, replace uk.premiervpn.net with any hostname from the table below.

Run in the background

sudo openconnect --user=YOUR_VPN_USERNAME --background --pid-file=/tmp/openconnect.pid uk.premiervpn.net

To disconnect:

sudo kill $(cat /tmp/openconnect.pid)

Connect without typing your password

You can keep your VPN password in a file that only your user can read, and pass it to OpenConnect:

printf '%s\n' 'YOUR_VPN_PASSWORD' > ~/.premiervpn-pass
chmod 600 ~/.premiervpn-pass
sudo openconnect --user=YOUR_VPN_USERNAME --passwd-on-stdin uk.premiervpn.net < ~/.premiervpn-pass

Only do this on a Mac you trust. If you change your VPN password in Settings › VPN Password, update the file too.

Server hostnames

You can also copy any hostname from the Servers page in the portal.

LocationHostname
Denmarkdn.premiervpn.net
Finlandfn.premiervpn.net
Francefr.premiervpn.net
Germanyde.premiervpn.net
Israelisr.premiervpn.net
Italyit.premiervpn.net
Netherlandsnl.premiervpn.net
Norwayno.premiervpn.net
Polandpl.premiervpn.net
Romaniaro.premiervpn.net
Spainsp.premiervpn.net
Swedensw.premiervpn.net
Switzerlandswiss.premiervpn.net
Turkeytr.premiervpn.net
United Kingdom (London)uk.premiervpn.net
Argentinaar.premiervpn.net
Brazilbr.premiervpn.net
Canadaca.premiervpn.net
Mexicomx.premiervpn.net
Perupe.premiervpn.net
United States (Kansas)ks.premiervpn.net
United States (Los Angeles)la.premiervpn.net
United States (New York)ny.premiervpn.net
United States (Santa Clara)sc.premiervpn.net
Australiaau.premiervpn.net
Hong Konghk.premiervpn.net
Indiain.premiervpn.net
Japanjp.premiervpn.net
Singaporesg.premiervpn.net
South Koreask.premiervpn.net

Troubleshooting

"Login failed" or the password is rejected

  • Use your VPN username and VPN password from the Dashboard, not your portal email and password.
  • Remember sudo asks for your Mac password first. The second prompt is for the VPN password.

Certificate verification failed

Our servers use a publicly trusted certificate, so this usually means the hostname is mistyped or your system certificates are out of date. Check the hostname against the table and install any pending macOS updates. Don't turn off certificate checks. If it still fails, open a support ticket with the full error message.

command not found: openconnect

Homebrew isn't on your path yet. Close and reopen Terminal, or follow the "Next steps" Homebrew printed at the end of its install.

Still stuck? Open a support ticket and tell us your macOS version, the command you ran and the error you see.

Something out of date or unclear? Let us know.

Stay Ahead of Online Threats

Get VPN tips, security insights, and exclusive offers delivered straight to your inbox. No spam — just the essentials.

Unsubscribe at any time. We respect your privacy.

PremierVPN Support