escript: bad_central_directory

escript: bad_central_directory

escript is packaged as part of the erlang otp and essentially executes uncompiled erlang code. Rebar delegates alot of work to it. Recently, I was getting the following error when trying to run the webmachine project files from the excellent book, ‘7 webservers in 7 weeks‘.

I’m running R16B02 on OS X
$ erl --version
Erlang R16B02 (erts-5.10.3) [source-b44b726] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

$ ./rebar clean get-deps compile
escript: bad_central_directory

Even getting the version of rebar failed
$ ./rebar version
escript: bad_central_directory


Download the latest version of rebar from github,
invoke their ./bootsrap command.
$ git clone git://
Cloning into 'rebar'...
remote: Counting objects: 6053, done.
remote: Compressing objects: 100% (2630/2630), done.
remote: Total 6053 (delta 3623), reused 5596 (delta 3205)
Receiving objects: 100% (6053/6053), 2.13 MiB | 554 KiB/s, done.
Resolving deltas: 100% (3623/3623), done.
$ cd rebar
$ ./bootstrap

This should build successfully. Verify by getting version

$ ./rebar version
rebar 2.1.0 R16B02 20131203_115508 git 2.1.0-13-g30531b6

Copy the rebar executable into the project which was giving the ‘escript’ error.
Invoke ‘make’ and should be able to build project successfully.