Skip to content
Run a command in a dotenv environment
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DotRun Command

DotRun command loads dotenv file, loads its environment and runs given command in that environment.


Unix users (Linux, BSDs and MacOSX)

Unix users may download and install latest dotrun release with command:

$ sh -c "$(curl"

If curl is not installed on you system, you might run:

$ sh -c "$(wget -O -"

Note: Some directories are protected, even as root, on MacOSX (since El Capitan release), thus you can't install dotrun in /usr/bin for instance.

Binary package

Otherwise, you can download latest binary archive at Unzip the archive, put the binary of your platform somewhere in your PATH and rename it dotrun.


To run command foo with its arguments in the environment defined in .env file in current directory, type:

$ dotrun foo args...

.env file might define environment such as:


foo will then be able to access this environment defined in .env file.

You can specify another dotenv file with -env file option before the command to run:

$ dotrun -env /etc/foo.env foo args...

You can also load multiple dotenv files, repeating -env file option on command line :

$ dotrun -env /etc/foo.env -env /etc/bar.env foo args...

The environment files are evaluated in the order of the command line, so that in previous example variables defined in bar.env would overwrite those defined in foo.env.


You can’t perform that action at this time.