Recently, I realized I haven't been able to run
. .zshrcin my home directory. It gives me the error above. It's really strange and it's bugging me out since it's worked perfectly fine in the past.
In the same directory, any of the below commands work fine
. ~/.zshrc
source .zshrc Output from echo $PATH | tr ':' '\n'
/Users/prashanthcr/.rvm/gems/ruby-2.2.0/bin
/Users/prashanthcr/.rvm/gems/ruby-2.2.0@global/bin
/Users/prashanthcr/.rvm/rubies/ruby-2.2.0/bin
/Users/prashanthcr/.nvm/versions/node/v5.5.0/bin
/Users/prashanthcr/Library/Android/sdk/platform-tools
/Users/prashanthcr/Library/Android/sdk/tools
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/opt/X11/bin
/usr/local/MacGPG2/bin
/Users/prashanthcr/.rvm/gems/ruby-2.2.0/bin
/Users/prashanthcr/.rvm/gems/ruby-2.2.0@global/bin
/Users/prashanthcr/.rvm/binUsing zsh on OS X 11.11.3
1 Answer
zsh is working as expected (see man zshbuiltins):
. Filesearches$PATHto findFileunless there is a/in the name; whilesourceis almost the same as., except that it searches the working directory first.
I don't know how . .zshrc worked previously, unless there was a bug in an earlier release of zsh.
You can:
alias .=source;- link
~/.zshrcto a directory in$PATH; - add your home directory to
$PATH(not recommended); or - live with having to type
. ./.zshrc(this is what I always do inbash, where.andsourceare identical, and I want to be sure of the location of the script).