Car*_*ell 3 macos bash homebrew zsh path
在这里似乎有一百个关于如何在Mac OS X/Linux环境中改变你的路径的问题....事实上,我认为实际上知道如何更改我的PATH变量,但似乎有些事情导致它被覆盖.我正在使用zsh并且试图Brew Doctor不警告我在user/local/bin之前使用usr/bin.我的〜/ .zprofile:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
echo $PATH
Run Code Online (Sandbox Code Playgroud)
登录后我得到:
Last login: Fri Oct 17 15:10:30 on ttys000
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Run Code Online (Sandbox Code Playgroud)
但是在登录后运行$ PATH我得到:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Run Code Online (Sandbox Code Playgroud)
我正在直接登录到zsh但是为了防止我的.profile和.bash-profile都包含与我的.zprofile相同的代码,并且我的/etc/paths.d目录中没有任何内容.是否有其他地方设置了PATH?我在这里错过了什么?
小智 8
来自:https: //wiki.archlinux.org/index.php/zsh
用户应注意/ etc/profile设置$ PATH变量,该变量将覆盖〜/ .zshenv中设置的任何$ PATH变量.为防止这种情况,请在〜/ .zshrc中设置$ PATH变量.(不建议将/ etc/zsh/zprofile中的默认行替换为其他内容,它会破坏在/etc/profile.d中提供某些脚本的其他包的完整性)
来自:http: //shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/
For zsh: [Note that zsh seems to read ~/.profile as well, if ~/.zshrc is not present.]
+----------------+-----------+-----------+------+
| |Interactive|Interactive|Script|
| |login |non-login | |
+----------------+-----------+-----------+------+
|/etc/zshenv | A | A | A |
+----------------+-----------+-----------+------+
|~/.zshenv | B | B | B |
+----------------+-----------+-----------+------+
|/etc/zprofile | C | | |
+----------------+-----------+-----------+------+
|~/.zprofile | D | | |
+----------------+-----------+-----------+------+
|/etc/zshrc | E | C | |
+----------------+-----------+-----------+------+
|~/.zshrc | F | D | |
+----------------+-----------+-----------+------+
|/etc/zlogin | G | | |
+----------------+-----------+-----------+------+
|~/.zlogin | H | | |
+----------------+-----------+-----------+------+
| | | | |
+----------------+-----------+-----------+------+
| | | | |
+----------------+-----------+-----------+------+
|~/.zlogout | I | | |
+----------------+-----------+-----------+------+
|/etc/zlogout | J | | |
+----------------+-----------+-----------+------+
Moral:
For bash, put stuff in ~/.bashrc, and make ~/.bash_profile source it.
For zsh, put stuff in ~/.zshrc, which is always executed.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1528 次 |
| 最近记录: |