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

Solution:

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"

OR

  1. Installation using homebrew

    brew install openvpn

  2. Information regarding binaries

    brew info openvpn

  3. It gave me the installation path as:

    /usr/local/Cellar/openvpn/2.4.0

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

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

How do I shorten the current directory path shown on terminal?

Problem:

If I am in a deep directory, let’s say:

~/Desktop/Dropbox/School/2017/C/A3/

then when I open up terminal, it says

bob@bob-ubuntu:~/Desktop/Dropbox/School/2017/C/A3/$

and then I write my command. That is very long, and every line I write in the terminal goes to the next line. I want to know if there’s a way so that it only displays my current directory. I want it to display:

bob@bob-ubuntu: A3/$

This way it’s much clear, and always I can do pwd to see my entire directory. I just don’t want the entire directory visible in terminal because it takes too much space.

Solution:

  1. You need to modify PS1 in your shell startup file (probably .bashrc).

    If it’s there already, its setting will contain \w, which is what gives your working directory. Change that to \W (upper case). Log out and in again, or do:

    . .bashrc
    

    (or whatever your file is).

    If it isn’t there, add something like:

    PS1='\u@\h: \W:\$'
    

    to .bashrc or whatever. Look up PS1 in the bash manual page to get more ideas.

    Be careful; bash can use several more than one initialisation file, e.g. .bashrc and .bash_profile; it may be that PS1 is set in a system-wide one. But you can override that in one of your own files.

    OR

  2. Since bash 4, the straightforward way to shorten the depth of directory in command-line is using the below command in your bashrc file. Just remember to reopen your terminal and also the number (i.e. 1) specifies the depth of the directory to show.

    PROMPT_DIRTRIM=1

Install homebrew without sudo in MacOS

Homebrew needs /usr/local to be chown-ed to your user, and you need sudo for that. If you can’t you have to install it elsewhere. Some people use ~/.brew or ~/homebrew; you can use anything but avoid paths with spaces.

Let’s say you want to install in ~/.brew; run the following command:

git clone --depth=1 https://github.com/Homebrew/brew ~/.brew

Then ensure the bin and sbin directories are in your PATH. If you’re using Bash add the following in your ~/.bash_profile:

export PATH="$HOME/.brew/bin:$HOME/.brew/sbin:$PATH"

Run source ~/.bash_profile or restart your shell and run brew doctor to see if it’s installed correctly. It should warn you it’s not installed into /usr/local but that’s expected here.

./path of file to execute not executing

I am trying to execute matlab from desktop path of file is

      /usr/local/MATLAB/R2017b/bin/matlab

executing ./usr/local/MATLAB/R2017b/bin/matlab

also tried .//usr/local/MATLAB/R2017b/bin/matlab

and ./ /usr/local/MATLAB/R2017b/bin/matlab
how it works?

Solution:

Just run /usr/local/MATLAB/R2017b/bin/matlab to access the binary via the full path otherwise you will run try to run it via the relative path: <CURRENT DIR>/usr/local/MATLAB/R2017b/bin/matlab if you put a . before.

You can also change the add /usr/local/MATLAB/R2017b/bin/ to your path variable in order to be able to execute the command matlab without having to specify its whole path each time.

Also change your ~/.bashrc file and add PATH=$PATH:/usr/local/MATLAB/R2017b/bin to be able to keep those change after a reboot and just run matlab

How to add a directory to the PATH ubuntu?

Edit .bashrc in your home directory and add the following line:

export PATH="/path/to/dir:$PATH"

You will need to source your .bashrc or logout/login (or restart the terminal) for the changes to take effect. To source your .bashrc, simply type

$ source ~/.bashrc