在Mac上将目录添加到PATH

时间:2012-12-23 05:48:00

标签: macos .bash-profile

我正在尝试在我的路径中添加一个目录,而我遇到了麻烦。我有Macbook Pro正在运行Mac OS X Lion 10.7.5。为了进行更改,我使用了命令:

open ~/.bash_profile

它打开了配置文件,看起来像这样:

export PATH=${PATH}:/Users/Banderson/android-sdks/tools 
export PATH=${PATH}:/Users/Banderson/android-sdks/platform-tools 
#
# Your previous /Users/Banderson/.bash_profile file was backed up as /Users/Banderson/.bash_profile.macports-saved_2012-05-16_at_09:53:57
##

# MacPorts Installer addition on 2012-05-16_at_09:53:57: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for JRuby 1.7.0.RC1
# The orginal version is saved in .bash_profile.jrubysave
PATH="${PATH}:/Library/Frameworks/JRuby.framework/Versions/Current/bin"
export PATH

然后我补充说:

   export PATH=${PATH}:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/

使.bash_profile看起来像这样:

export PATH=${PATH}:/Users/Banderson/android-sdks/tools 
export PATH=${PATH}:/Users/Banderson/android-sdks/platform-tools 
export PATH=${PATH}:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/
#
# Your previous /Users/Banderson/.bash_profile file was backed up as /Users/Banderson/.bash_profile.macports-saved_2012-05-16_at_09:53:57
##

# MacPorts Installer addition on 2012-05-16_at_09:53:57: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.


[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for JRuby 1.7.0.RC1
# The orginal version is saved in .bash_profile.jrubysave
PATH="${PATH}:/Library/Frameworks/JRuby.framework/Versions/Current/bin"
export PATH

我添加之后,我保存了它,然后在终端中,我执行了source ~/.bash_profile命令,退出终端窗口,启动了一个新窗口,并尝试从我添加到的目录中启动一个文件路径,但它没有奏效。有人可以告诉我我做错了什么以及如何解决它?

编辑:

以下是echo $PATH返回的内容:

/Users/Banderson/.rvm/gems/jruby-1.6.8/bin:/Users/Banderson/.rvm/gems/jruby-1.6.8@global/bin:/Users/Banderson/.rvm/rubies/jruby-1.6.8/bin:/Users/Banderson/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Banderson/android-sdks/tools:/Users/Banderson/android-sdks/platform-tools:/Users/Banderson/Documents/awstats-7.1/wwwroot/cgi-bin/:/Library/Frameworks/JRuby.framework/Versions/Current/bin

1 个答案:

答案 0 :(得分:0)

您的问题似乎是包含rvm脚本。我想,你的路径被覆盖了。