首页 > 系统服务 > 详细

Mac 终端每次启动都要执行 source .bash_profile

时间:2019-11-22 13:53:47      阅读:179      评论:0      收藏:0      [点我收藏+]

网上说法都是

发现zsh加载的是 ~/.zshrc文件,而 ‘.zshrc’ 文件中并没有定义任务环境变量。

但是我搜索zsh找到的只有一个叫做「oh my zsh」的东西,我并没有装这个软件

还有一种说法是修改.profile文件,试过了,不好使


最后我在Stack Overflow上找到了答案

https://stackoverflow.com/questions/15733508/why-do-i-need-to-source-bash-profile-every-time

Now that we‘ve narrowed down the problem:

  1. Run ps -p $$ at the command line to determine that you are, in fact, using a bash shell.
  2. Realize that you are in zsh, which means you should be editing your profile in .zshrc.
  3. Copy the offending lines from .bash_profile to .zsh, OR
  4. Modify your .zshrc to directly source your .bash_profile.

执行ps -p $$,发现结果是

  PID TTY           TIME CMD
  692 ttys000    0:00.03 -zsh

好吧。。。虽然不知道是为什么会是zsh,但自此问题解决

Mac 终端每次启动都要执行 source .bash_profile

原文:https://www.cnblogs.com/n031/p/11910788.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!