zshfishtcshdirenvelvish

Why is direnv failing to read my zsh/fish/elvish/tcsh script?


When attempting to evaluate a .envrc file I get the error "emulate: command not found" or "cd: -q: invalid option" or any number of various possible errors in my completely valid zsh/fish/elivsh/tcsh script.


Solution

  • direnv uses only bash to evaluate your .envrc file. It then exports the changes back to your original shell. You'll have to rewrite your .envrc in bash.

    Also check out direnv stdlib for the utility functions that direnv gives you access to from within any .envrc file.