这是我的.bash_profile和.profile文件:
BASH PROFILE
# Set architecture flags
export ARCHFLAGS="-arch x86_64"
# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
export PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH="$HOME/Applications/Postgres.app/Contents/Versions/9.3/bin:$PATH"
#Virtualenvwrapper
export WORKON_HOME=$HOME/Devaus/Envs
export PROJECT_HOME=$HOME/Devaus/Envs
source /usr/local/bin/virtualenvwrapper.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
PROFILE
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
echo $ PATH
/Users/User/Devaus/Envs/wsd/bin:/Users/User/.rvm/gems/ruby-2.1.1/bin:/Users/User/.rvm/gems/ruby- 2.1.1@global/bin:/Users/User/.rvm/rubies/ruby- 2.1.1/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/User/.rvm/bin
问题是为什么/Applications/Postgres.app/Contents/Versions/9.3/bin
不会被添加到PATH中?我的目标是使用此处http://postgresapp.com/documentation/cli-tools.html
psql
等命令
答案 0 :(得分:1)
如果您有.profile
,Bash不会自动阅读.bash_profile
。通常情况下设置为.bash_profile
明确加载.profile
,但您似乎没有。{也许将其添加到.bash_profile
:
test -e ~/.profile && . ~/.profile
或者将这些内容放在.bash_profile
中;但是,如果您需要/bin/sh
中的部分或全部设置,则无法执行此操作。通常更好的安排是只在.bash_profile
中使用专门的Bash代码,并使.profile
可移植到经典的Bourne shell(在变量赋值之前不允许export
;所以你有语法错误
export variable=value
应该是
variable=value
export variable
代替便携性。)
顺便说一句,您只需要export
一次(并且在Bash运行您的个人登录文件时,PATH
应该已经导出了。)