OpenConnect can be installed via homebrew:
brew update
brew install openconnect
Running openconnect requires sudo, presumably because it affects resolution of DNS, but you can add password-less sudo ability for the openconnect command.
Open:
sudo visudo -f /etc/sudoers
Add this line:
%admin ALL=(ALL) NOPASSWD: /usr/local/bin/openconnect
Entering password each time, when you connect to VPN, can be annoying, so you can store it in the keychain.
Open "Keychain Access" app, click "File -> New password item". Once it's created, you can access it from the command line usingsecurity find-generic-password -s <keychain_item_name> -w
.
security find-generic-password -s vpn -w | sudo openconnect --user <username> <host>