Fork me on GitHub

Mac 环境变量

1
2
vim ~/.bash_profile
source ~/.bash_profile

.bash_profile 内容如下

1
2
3
4
5
6
export RUBYOPT=-KU
export PATH=$PATH:/Users/xxx/Documents/platform-tools/
export PATH=${PATH}:/usr/local/mysql/bin/:/usr/local/opt/php56/bin

alias ll='ls -l'
alias gotosh='cd ~/sh'

但 .bash_profile 只在用户登录时加载一次,新开终端时不会再次加载
借助 iterms 的 Send text as start 实现新开终端加载
iterm

后来环境变量和其它分开放
.bash_profile

1
2
3
4
5
6
7
export RUBYOPT=-KU
export PATH=$PATH:/Users/xxx/Documents/platform-tools/
export PATH=${PATH}:/usr/local/mysql/bin/:/usr/local/opt/php56/bin

if test -f ~/.bashrc ; then
source ~/.bashrc
fi

.bashrc

1
2
alias ll='ls -l'
alias gotosh='cd ~/sh'

-------------感谢您的阅读 有问题请留言(或mailto:frostbelt@sina.cn)-------------