Relationship Between Archive Tasks and Building escripts

Hi folks.

I’m looking at two libraries that have very different instructions for installing them globally. The libraries in question are dogma and dialyxir.

dogma's instructions is to build the escript, put the resulting executable somewhere in my $PATH, and that’s it.

dialyxir's instructions, on the other hand require mix && mix archive.install.

I used both methods on dogma, just to check out the results. In the first case, using escript, an executable was built. When I used the mix archive tasks, it created a set of *.beam files as well as a that were in my ~/.mix/archives/dogma-0.1.8/dogma-0.1.8/ebin directory.

Anyways, I found it interesting that there are two ways to do this, and wanted to know if they are equivalent or if there’s a difference.


Elixir v1.3 supports installing escripts. We recommend using escripts because they address the two biggest downsides in archives. Archives pollute your Mix projects (you will be able to access a module from an archive inside your applications) and they depend on your local Elixir installation too. With escripts, they are isolated binaries with Elixir included.

Archives should be used almost exclusively for adding new SCMs to Mix (like Hex, Mercurial, etc). If you have the option of using an escript, you should use an escript.


Thank you @josevalim!

For others looking at this post, these docs explains the process to install an escript.

1 Like

Am I correct in thinking.

  • An archive needs to have erlang (and elixir) installed, it can be run anywhere
  • An escript once build does not need erlang to be installed?

What do you mean by SCM here