Installed openvpn with brew but it doesn't appear to be installed correctly

I installed openvpn with brew. The installation went fine, no errors or missing dependencies. But now when I try to run it:

users-MBP:~ user$ brew install openvpn
Warning: openvpn-2.3.7 already installed
users-MBP:~ user$ openvpn
-bash: openvpn: command not found

I based myself on this tutorial: https://my.hostvpn.com/knowledgebase/29/OpenVPN-on-Mac-OS-X-via-Homebrew-CLI.html


Solution 1:

At the terminal type:

echo $PATH 

That's your default search path for executables. Looks like the openvpn executable was installed someplace not in your search path.

First, you'll need to find the openvpn executable:

sudo find / -type f -name "openvpn" 

Then add the directory containing the openvpn executable to your default search path by adding this sort of line to the end of your .profile (in your home directory, a.k.a. /Users/yourusername/.profile:

export PATH="/some/brew/dir:$PATH"

Solution 2:

Add this to your ~/.bash_profile:

export PATH=$(brew --prefix openvpn)/sbin:$PATH