How to compile an executable

How do I compile a standalone executable? I just want to run a program from the console/terminal without using iex. there you go! :smiley:

thanks that site is really good


Please do not use URL-shorteners.

I do know about companies as well as universities blocking such services for security reasons. For my university the only shortener allowed is twitters (which is used somewhat automagically when tweeting).

Also I do know about some services that pay the guy who shortened an URL by showing ads on a redirection page, while neither the one who follows a link nor the guy who write the original article get their share.

For exactly this reason I deny to click any URL that seems to be shortened.

I have taken the liberty to expand the URL.

But to provide a more direct answer:

  • You can use escript which comes with Elixir (mix has a built-in task to do this) to build a standalone archive. This kind of standalone will run on any computer, as long as it has (a recent version of) Erlang installed.
  • You can use systems like exrm relx or edeliver(which might be easier to use, and uses either exrm or relx underwater) to create a so-called release, which can then be put somewhere as a completely standalone executable, as it includes the current version of Erlang and Elixir. The nice thing about this is that you can later create new versions, and use hot-code swapping on your already-running application with them.