[英]OSX - ZSH - PATH - /usr/bin duplicated
I need some help to understand why my path looks like the way it looks.我需要一些帮助来理解为什么我的路径看起来像它的样子。
Issuing echo $PATH in zsh returns:在 zsh 中发出 echo $PATH 返回:
/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/bin/:/bin:/usr/sbin:/sbin:
/usr/local/bin:/usr/X11/bin:/usr/local/go/bin:/usr/bin
Now, let's have a closer look of the different parts:现在,让我们仔细看看不同的部分:
- /Library/Frameworks/Python.framework/Versions/3.2/bin:
it comes from my.zprofile (Python 3 installation)它来自 my.zprofile(Python 3 安装)
- /usr/bin/:
- /bin:
- /usr/sbin:
- /sbin:
- /usr/local/bin:
These parts come from my /etc/paths folder.这些部分来自我的 /etc/paths 文件夹。
- /usr/X11/bin:
This part come from my etc/path.d folder这部分来自我的 etc/path.d 文件夹
- /usr/local/go/bin:
This part was added during GO installation.这部分是在 GO 安装期间添加的。
- /usr/bin
??? ???
I have looked at -/etc/paths -.zshrc -.zprofile -.profile -/etc/profile -.zshenv.我查看了 -/etc/paths -.zshrc -.zprofile -.profile -/etc/profile -.zshenv。 None of them sourced or added a second /user/bin neither to the PATH.他们都没有向 PATH 采购或添加第二个 /user/bin 。
How can I remove the second /user/bin from my PATH if I don't know which file to edit?如果我不知道要编辑哪个文件,如何从 PATH 中删除第二个 /user/bin?
Thank you.谢谢你。
在ZSH中,删除PATH变量中的重复项是通过typeset -U PATH
完成的,而不是typeset -u PATH
(后者只是将内容转换为大写...)
While this doesn't explain where the second /usr/bin
comes from, you can put typeset -u PATH
after the last place you append anything to $PATH. 虽然这不能解释第二个/usr/bin
来源,但是你可以在最后一个地方添加typeset -u PATH
,你可以将任何东西附加到$ PATH。 This will remove duplicate entries. 这将删除重复的条目。
Use zsh to enter the command zsh
shell and then use typeset -u PATH
to remove the duplicates.使用 zsh 输入命令zsh
shell 然后使用 typeset typeset -u PATH
删除重复项。 I have used small -u in typeset, but it has turned the variables into uppercase and hasnt removed the duplicates.我在排版中使用了 small -u,但它已将变量转换为大写并且没有删除重复项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.