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
- Enter your Mac's login password first (this is for
sudo). - Then enter your VPN password when OpenConnect asks for it.
- Leave the Terminal window open while you use the VPN. Press
Ctrl+Cto 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.
| Location | Hostname |
|---|---|
| Denmark | dn.premiervpn.net |
| Finland | fn.premiervpn.net |
| France | fr.premiervpn.net |
| Germany | de.premiervpn.net |
| Israel | isr.premiervpn.net |
| Italy | it.premiervpn.net |
| Netherlands | nl.premiervpn.net |
| Norway | no.premiervpn.net |
| Poland | pl.premiervpn.net |
| Romania | ro.premiervpn.net |
| Spain | sp.premiervpn.net |
| Sweden | sw.premiervpn.net |
| Switzerland | swiss.premiervpn.net |
| Turkey | tr.premiervpn.net |
| United Kingdom (London) | uk.premiervpn.net |
| Argentina | ar.premiervpn.net |
| Brazil | br.premiervpn.net |
| Canada | ca.premiervpn.net |
| Mexico | mx.premiervpn.net |
| Peru | pe.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 |
| Australia | au.premiervpn.net |
| Hong Kong | hk.premiervpn.net |
| India | in.premiervpn.net |
| Japan | jp.premiervpn.net |
| Singapore | sg.premiervpn.net |
| South Korea | sk.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
sudoasks 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.