zsh – How Commands are Found in Catalina

catalinapathzsh

Unless I switch back to bash, I now have to spell out the full path for scripts I have written. How does zsh find commands?

Things in /bin, /use/bin, etc. still work, but things in ~/bin are “not found” even when that path is at the beginning of both $PATH and $path.

After putting

PATH="~/bin:$PATH
path="$PATH"

in ~/.zshrc,

echo $PATH; echo $path

shows it at the beginning of the path, but it still doesn't find the commands. (And it's not permissions: the scripts work when I type their full paths.)

Best Answer

zsh doesn't expand ~ within quotes. You need to use

PATH=~/bin:$PATH

instead.

PS: And path=$PATH is not required, zsh does this automatically