Karoh
Karoh

Reputation: 2470

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

$ $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.

Upvotes: 141

Views: 347148

Answers (5)

Temi Fakunle
Temi Fakunle

Reputation: 972

To list out the paths as individual lines, you could use:

echo "${PATH//:/\n}"

Upvotes: 68

Lam Do
Lam Do

Reputation: 518

for MacOS, make sure you know where the GO install

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

Upvotes: -3

AlexSh
AlexSh

Reputation: 1575

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:

Upvotes: 3

HeatfanJohn
HeatfanJohn

Reputation: 7323

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.

Upvotes: 220

paxdiablo
paxdiablo

Reputation: 881093

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

Upvotes: 48

Related Questions