Connect Using OpenConnect on macOS

Last updated 15 Mar 2026 · 6 views

On macOS, OpenConnect can be installed via Homebrew and used from the terminal, or through a GUI wrapper.

Install via Homebrew

If you have Homebrew installed:

brew install openconnect

If you don't have Homebrew, install it first from brew.sh.

Connect via Terminal

sudo openconnect uk.premiervpn.net --user=YOUR_VPN_USERNAME

Enter your VPN password when prompted. The connection will stay active in the terminal — press Ctrl+C to disconnect.

Alternative: Connect with Protocol Specified

sudo openconnect --protocol=anyconnect uk.premiervpn.net --user=YOUR_VPN_USERNAME

Run in the Background

To run the VPN in the background:

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

To disconnect:

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

Available Servers

Replace uk.premiervpn.net with any of the following:

Location Hostname
United Kingdom uk.premiervpn.net
Germany de.premiervpn.net
Spain sp.premiervpn.net
France fr.premiervpn.net
Netherlands nl.premiervpn.net
United States (Kansas) ks.premiervpn.net
United States (New York) ny.premiervpn.net
United States (Los Angeles) la.premiervpn.net
Canada ca.premiervpn.net
Australia au.premiervpn.net
Japan jp.premiervpn.net
Singapore sg.premiervpn.net

FAQs

I get a "certificate verify failed" error. What do I do?

On first connection, add the --servercert flag to pin the certificate, or use --no-cert-check temporarily (not recommended for production use). After the first connection, the certificate will be trusted.

Can I save my password?

You can pass your password via stdin: echo "YOUR_PASSWORD" | sudo openconnect uk.premiervpn.net --user=YOUR_USERNAME --passwd-on-stdin

However, storing passwords in scripts is not recommended for security reasons.