Live reload plugin for
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.


A live reload plugin for


First, add as a plugin and a build dependency:

PROJECT = myproject
BUILD_DEPS = reload_mk
DEP_PLUGINS = reload_mk


Then in one terminal: make run RELOADABLE=1. Keep it running.

Now you can modify any source files in your project and run make reload:

% make reload
 DEPEND myproject.d
 ERLC   myproject.erl myproject_app.erl
 APP    myproject
 RELOAD myproject

=INFO REPORT==== 3-Oct-2015::15:05:18 ===
    reload_mk: "Reloaded"
    module: myproject
    path: "/home/bullno1/Projects/myproject/_rel/myproject_release/lib/myproject-rolling/ebin/myproject.beam"
** at node myproject@ **

To avoid having to type make reload all the time, use make auto-reload. You need to have inotify-tools installed for this command to work.

An example project can be found at

Running code on reload

It is possible to have a function called whenever a module is reloaded. This is useful for things like reloading cowboy's route. To do so, just use the on_reload attribute:

-export([reload_routes/0]). % Reload function must be exported

reload_routes() ->
	cowboy:set_env(my_http_listener, dispatch, cowboy_router:compile(dispatch())).

dispatch() ->
	% Routes

Now, every time my_http_listener is modified, it will automatically calls reload_routes.


RELOAD_MK_WATCH_DIRS can be set to a list of directories that make auto-reload needs to watch. For example, if you are using erlydtl templates, put the following in your Makefile:

RELOAD_MK_WATCH_DIRS = src templates

By default, it is set to src deps.