How can I see the current value of my $PATH variable on OS X?
$ $PATH
收益:
-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
这看起来很丑陋,也可能让我在启动和运行Homebrew方面遇到问题。
您需要使用命令
通过键入
Bash以任何方式显示路径的内容。 根据您的输出,将按以下顺序搜索以下目录:
1 2 3 4 5 6 7 8 9 10 11 12 13 | /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 |
对我来说,这个列表似乎是完整的。
通过在命令提示符下单独输入
如果你想看看路径是什么,只需回显它:
1 | echo $PATH |
使用命令:
1 | echo $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:
对于MacOS,请确保您知道GO安装的位置
1 2 | export GOPATH=/usr/local/go PATH=$PATH:$GOPATH/bin |