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

  • Out of curiosity, why did you not choose to go with TunnelBlick? – agentroadkill Sep 2 '15 at 23:28
  • 1
    @agentroadkill After some time on Linux I have a strong preference for command-line tools over GUIs. Whenever possible I try to go for a CLI solution. – Juicy Sep 2 '15 at 23:33
  • I believe TunnelBlick is fully configurable from command line, though I rarely use it as I generally use it for simplistic end-user functions. – agentroadkill Sep 2 '15 at 23:36
  • 1
    @agentroadkill I may look into it. openvpn also has the advantage of being the same tool I used on Linux for the job so I could just copy over my configuration files, same commands etc... But I will look into TunnelBlick if I can't get it working. – Juicy Sep 2 '15 at 23:44
  • TunnelBlick is just an OpenVPN client for MacOS. Any OpenVPN config generated for Linux and/or Windows can be used with it. – agentroadkill Sep 2 '15 at 23:46

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"
| improve this answer | |
  • 11
    brew info openvpn is faster – igor Nov 16 '16 at 23:44
  • Try using sudo openvpn before going with this answer. It seems silly, but I was going through this answer when I found openvpn is installed in the usr/sbin folder - which means that you can't execute openvpn or anything else in that folder without sudo - and you will get openvpn: command not found without using sudo. Or you can login as root, but that's just unnecessary. Hope this helps someone else. – Devin Carpenter Feb 12 at 22:00

Add this to your ~/.bash_profile:

export PATH=$(brew --prefix openvpn)/sbin:$PATH
| improve this answer | |
  • 12
    You won my heart – Lo-Tan Nov 27 '17 at 16:23

You have to add /usr/local/sbin to your path.

It was installed to /usr/local/sbin but that directory is not in your $PATH by default. Add a line like this to your ~/.bashrc or equivalent:

export PATH=/usr/local/sbin:$PATH
| improve this answer | |
  • This is the best fix, but the best, permanent way to make the fix it is to edit /etc/paths and add /usr/local/sbin to it (more info here) – MikeBeaton Jan 16 '19 at 9:34

In my case:

  1. Installation using homebrew

brew install openvpn

  1. Information regarding binaries

brew info openvpn

  1. It gave me installation path as:


  1. Then I browsed for bin directory but found executable inside sbin. So, I added following line

export PATH=$PATH:/usr/local/Cellar/openvpn/2.4.0/sbin

in my ~/.zshrc file as well as in ~/.bash_profile file using a text editor.

Worked Flawlessly, After a workaround for an hour :)

| improve this answer | |

I was having same issue today and I had to do sudo brew services start openvpn

| improve this answer | |

Brew now link the openvpn binary. reinstall it using

brew reinstall openvpn
| improve this answer | |

You can also add a symlink from usr/local/sbin into usr/local/bin like so:

cd /usr/local/bin
ln -s ../sbin/openvpn .
| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .