Problem:
I have recently upgraded from macOS Mojave 10.14.6 to macOS Catalina 10.5.5.
Now that zsh
is the default shell, I migrated my .bashrc
to .zshrc
:
~/bin/my/
and ~/bin/dev/
are
zsh: command not found: myScript.sh
Investigation & Troubleshooting:
echo $PATH
gives /opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/sbin:~/bin/bin:~/bin/my:~/bin/dev:
Experiments:
export
keyword. --> Makes no difference.alias test123="echo test123"
I found the solution in William Pursell's answer concerning Weird behaviour with zsh PATH:
Try using $HOME instead of ~. In many situations, shells do not expand ~ when you expect them to and it is usually better to use $HOME. ~ is really only intended to be a short cut for interactive use.
From then on zsh worked as expected and considered all my custom user scripts in ~/bin/*
after I have replaced all my ~
tilde placeholders with $HOME
variables in my $PATH
. — What a great difference a wrong character can make!