Directory-based environments.
Shell Python Makefile
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead, 67 commits behind kennethreitz:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Autoenv: Directory-based Environments

Magic per-project shell environments. Very pretentious.

What is it?

If a directory contains a .env file, it will automatically be executed when you cd into it.

This is great for...

  • auto-activating virtualenvs
  • project-specific environment variables
  • making millions

You can also nest envs within each other. How awesome is that!?

When executing, autoenv, will walk up the directories until the mount point and execute all .env files beginning at the top.


Follow the white rabbit:

$ echo "echo 'woah'" > project/.env
$ cd project


Install it easily:

Mac OS X Using Homebrew

$ brew install autoenv
$ echo 'source $(brew --prefix autoenv)/' >> ~/.bash_profile

Using pip

$ pip install autoenv
$ echo "source `which`" >> ~/.bashrc

Using git

$ git clone git:// ~/.autoenv
$ echo 'source ~/.autoenv/' >> ~/.bashrc

Using AUR

Arch Linux users can install autoenv or autoenv-git with their favorite AUR helper.

You need to source in your bashrc afterwards:

$ echo 'source /usr/share/autoenv/' >> ~/.bashrc


Before sourcing, you can set the following variables:

  • AUTOENV_AUTH_FILE: Authorized env files, defaults to ~/.autoenv_authorized
  • AUTOENV_ENV_FILENAME: Name of the .env file, defaults to .env
  • AUTOENV_LOWER_FIRST: Set this variable to flip the order of .env files exectued


autoenv is tested on:

  • bash
  • zsh
  • dash
  • more to come


Autoenv overrides cd. If you already do this, invoke autoenv_init within your custom cd after sourcing

Autoenv can be disabled via unset cd if you experience I/O issues with certain file systems, particularly those that are FUSE-based (such as smbnetfs).