关于第三方终端command not found不加载.bash_profile 解决方法

解决方法来自

http://superuser.com/questions/573633/bash-profile-not-sourced

解决command not found

如使用iterm2 + oh my zsh时

~ mysql
zsh: command not found: mysql

是因为未设置环境变量
参见http://yijiebuyi.com/blog/41ee3bab0c5bf1d43c7a8ccc7f0fe44e.html
比较安全灵活的方法就是~/.bash_profile 或者~/.zshrc或者 ~/.bashrc里添加环境:

# mysql
alias mysql='/usr/local/mysql/bin/mysql'
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'

因为我是用的 oh my zsh 不会自动加载~/.bash_profile而是~/.zshrc,其它可能是加载~/.bashrc

==下面这个方法有问题,可以参考==

三方终端自动加载.bash_profile

但是有些童鞋使用第三方terminal 时会发现问题依旧,那是因为部分第三方ternimal不会自动加载 .bash_profile文件,导致 需要手动加载:source ~/.bash_profile
方法:
Terminal -> Preferences -> Startup 选项卡, 在 “Shell Opens With:” 把 “Default login shell” 改为 Command 再 填写:

source  ~/.bash_profile

==PS:自己创建的~/.bash_profile 重启后会消失,所以第二个方式可能有问题,希望大神不吝赐教。==

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值