Smarter Erlang Programming With Emakefile Options and User_default

Say you’ve got an Erlang app with the standard file system layout, with your source code in src/ and your compiled code in ebin/. I’ve found this makes using the interactive shell interpreter a little harder.

Lets use the Emakefile that Erlang supports to let us recompile and reload our code on the fly.

Create a file called Emakefile, and put the below line in it. There’s other options, but this keeps things simple.

{"src/*", [report, verbose, {i, "include"}, {outdir, "ebin"}] }.

Now you can recompile & load everything like this:

1> make:all([load]).

But as far as I can tell, it won’t see your ebin directory. Keep reading.

Lets kick it up a notch. Typing make:all([load]) is obnoxious - lets use the power of user_default as written below.

I wasn’t able to get the user_default module to work unless I specifically loaded it as follows:


(Found on

Here’s all I have in there - I really just needed r() to work to reload everything.

r( ) ->
    make:all( [load] ).

I’ve been told there’s a reloader script in mochiweb that will auto load everything for you - that’ll be the subject of a later blog post. (edit: finally wrote the autoloader how to)


If you found this post helpful, please consider sharing to your network. I'm also available to help you be successful with your distributed systems! Please reach out if you're interested in working with me, and I'll be happy to schedule a free one-hour consultation.