Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Autorunner is a command line utility that automatically runs a command when a file is saved.


First install node, then:

npm install -g autorunner


At the top of any file, add autorun: COMMAND, then invoke autorunner with the filename as an argument. Each time the file is saved, COMMAND will be run.

For example, say we have a file, and every time the file is saved it should be compiled with coffee -c

Just add the following line to the top of

# autorun: coffee -c

and watch with autorunner:

$ autorunner

Note that this example could also be accomplished with coffee -wc - autorunner is a more generic solution.

Filepath Insertion

We can generalize the autorun script by automatically inserting the filename:

# autorun: coffee -c $FILEPATH

Here, $FILEPATH will be replaced with the full path to before the command is run.

Wildcard Watching

Multiple files can be watched at once by appending them to the argument list, or feeding autorunner a wildcard.

For example, to autorun the commands on every .coffee and .rb script in the current directory, you could use:

$ autorunner *.coffee *.rb

Use Cases

Refresh Chrome when an HTML file is updated

On Mac, add the following to the top of your HTML files:

autorun: osascript -e 'tell application "Google Chrome" to tell the active tab of its first window to reload'

Then watch them with:

$ autorunner *.html

Automatically Run a Ruby script

Add the following to your Ruby files:

# autorun: ruby $FILEPATH

Then watch them with:

$ autorunner *.rb

Have your computer announce the number of words in your .md file

On Mac, add this to your markdown files:

autorun: say `wc -w < $FILEPATH` words

Then watch them with:

$ autorunner *.md

Automatically scp your python scripts when saving

Add this to your python script:

# autorun: scp $FILEPATH

Then watch them with:

$ autorunner *.py


Pull requests, comments, and criticisms are welcome!


Automatically run a command when a file is saved.




No releases published


No packages published
You can’t perform that action at this time.