Directory-based environments for the Fish shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Directory-based environments for fish shell, inspired by Kenneth Reitz's autoenv. If you miss that from your bash-using days, then miss it no longer.

What is it?

If a directory (or one of its parents) contains a file, it will be sourced when you cd into it.

In practice, you could do whatever you like—the file is sourced and run like any fish script. In practice, I end up using it mainly for setting project-specific environment variables for local development:

set -gx DJANGO_SECRET_KEY "s00persekr1t"
set -gx DJANGO_SETTINGS_MODULE "myappname.settings.local"
set -gx AWS_ACCESS_KEY_ID "xxxxxxxxxxxxxxxxxxxx"
set -gx AWS_SECRET_ACCESS_KEY "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"

See some more stuff about security implications below.


  1. Put somewhere handy. I like to put it in ~/.config/fish/
  2. Source the file in your
# load
. ~/.config/fish/

If you want it to take effect for your current terminal sessions, reload your by typing . path/to/your/ in every terminal window. If you're using iTerm2, typing ⌘⇧I is handy for broadcasting what you type to every open terminal.


Create a file somewhere. Fill it up with whatever valid fish script you like. It'll get sourced whenever you are in the directory, and you'll see a message telling you so.

Security Considerations

AutoenvFish won't bat an eyelash if your includes a line like sudo rm -rf /*. Be careful what you put in your files.

One of the things which autoenv does nicely is hashing of the executed files and a warning every time it changes. I'd like to add that in a future release.