How can I see the current value of my $PATH variable on OS X?

MacosBashPathEnvironment VariablesHomebrew

Macos Problem Overview


> $ $PATH

returns:

> -bash: /usr/local/share/npm/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/sbin:~/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin: No such file or directory

This seems quite ugly and might be giving me issues with getting Homebrew up and running as well.

Macos Solutions


Solution 1 - Macos

You need to use the command echo $PATH to display the PATH variable or you can just execute set or env to display all of your environment variables.

By typing $PATH you tried to run your PATH variable contents as a command name.

Bash displayed the contents of your path any way. Based on your output the following directories will be searched in the following order:

/usr/local/share/npm/bin
/Library/Frameworks/Python.framework/Versions/2.7/bin
/usr/local/bin
/usr/local/sbin
~/bin
/Library/Frameworks/Python.framework/Versions/Current/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
/opt/X11/bin
/usr/local/git/bin

To me this list appears to be complete.

Solution 2 - Macos

By entering $PATH on its own at the command prompt, you're trying to run it. This isn't like Windows where you can get your path output by simply typing path.

If you want to see what the path is, simply echo it:

echo $PATH

Solution 3 - Macos

To list out the paths as individual lines, you could use: echo "${PATH//:/\n}"

Solution 4 - Macos

Use the command:

 echo $PATH

and you will see all path:

> /Users/name/.rvm/gems/ruby-2.5.1@pe/bin:/Users/name/.rvm/gems/ruby-2.5.1@global/bin:/Users/sasha/.rvm/rubies/ruby-2.5.1/bin:/Users/sasha/.rvm/bin:

Solution 5 - Macos

for MacOS, make sure you know where the GO install

export GOPATH=/usr/local/go
PATH=$PATH:$GOPATH/bin

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKarohView Question on Stackoverflow
Solution 1 - MacosHeatfanJohnView Answer on Stackoverflow
Solution 2 - MacospaxdiabloView Answer on Stackoverflow
Solution 3 - MacosTemi FakunleView Answer on Stackoverflow
Solution 4 - MacosAlexShView Answer on Stackoverflow
Solution 5 - MacosLam DoView Answer on Stackoverflow