How to compile and run Elixir from command prompt?

How to compile and run Elixir from the command prompt.

If you are in Mix project then you can use mix compile to compile and then iex -S mix to run it in REPL (or mix run as independent app). If you want to compile single file then you can use elixirc file.ex and then it will produce Elixir.YourModule.beam which will be automatically loaded by IEx if you run it in the same directory as the compiled BEAM file.

1 Like