PATH variable in .zshenv or .zshrc

后端 未结 3 1099
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-19 16:50

My setup is zsh 5.0.5 in arch linux

I have set the PATH variable as below in .zshenv

typeset -U path
path=(~/bin $path)
DW=$HOME/Downloads
相关标签:
3条回答
  • 2021-02-19 17:15

    I just encountered this problem myself, and the real answer is that Zsh on Arch sources /etc/profile – which overwrites and exports PATHafter having sourced ~/.zshenv.

    See: https://wiki.archlinux.org/index.php/Zsh#Configuration_files

    0 讨论(0)
  • 2021-02-19 17:16

    It seems that when you have macos or some linux distros there is a canonical solution to the problem which involves /etc/paths or /etc/paths.d. You should be letting /usr/libexec/path_helper construct your path for you using configuration files.

    This immediately solved the problem in all places for me.

    0 讨论(0)
  • 2021-02-19 17:16

    I've got the same problem. The cause was my .zshrc (fresh install of oh-my-zsh) override PATH (ignoring existing value):

    export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl"
    

    To fix, I comment the line.

    0 讨论(0)
提交回复
热议问题