Recently, I realized I haven't been able to run

. .zshrc 

in 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/bin 

Using zsh on OS X 11.11.3

1 Answer

zsh is working as expected (see man zshbuiltins):

  • . File searches $PATH to find File unless there is a / in the name; while
  • source is 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:

  1. alias .=source;
  2. link ~/.zshrc to a directory in $PATH;
  3. add your home directory to $PATH (not recommended); or
  4. live with having to type . ./.zshrc (this is what I always do in bash, where . and source are identical, and I want to be sure of the location of the script).
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy