How to use the Mullvad CLI
Follow these instructions to use the Mullvad command line interface (CLI) in your operating system's terminal.
If you haven't already, first download the Mullvad VPN app and install it.
Add the CLI binary to your PATH
In order for your terminal/console to find the mullvad CLI binary, the Mullvad VPN app resource directory must be present in the PATH environment variable, which is where your OS searches for binaries.
Open the terminal and run the following commands:
echo 'export PATH="/Applications/Mullvad VPN.app/Contents/Resources:$PATH"' >> ~/.bash_profile
- In the Windows Start menu, search for and open advanced system settings.
- In the System Properties window that opens, click on the Environment Variables button.
- Under the System variables section, find and double-click on the row called Path.
- In the new window that opens, click on New and enter "C:\Program Files\Mullvad VPN\resources\"
The Mullvad VPN CLI is added to a system wide PATH directory (/usr/bin/) by default, so nothing has to be done here.
These are the various commands available to you
Specify your account
Replace the number string with your Mullvad account number.
mullvad account set 1234123412341234
Show account info
This command will show your account number and the expiration date of your account.
mullvad account get
List server locations
This command displays a list of available countries and cities.
mullvad relay list
Select a location
In this example, we are connecting to a server in Sweden (se), in the city of Malmö (mma).
Replace "se" with the country of your choice and, optionally, "mma" with a specific city in that country.
mullvad relay set location se mma
Connect to the location that you selected.
Check your connection status
Auto-connect on start-up
If you want Mullvad to start and connect when you boot up your computer, use this command.
mullvad auto-connect set on
To turn this off, run
mullvad auto-connect set off
Enable LAN access
mullvad lan set allow