Is it possible to use the `elixir` cli tool to output .beam files?

I’m writing a little post that touches on modules and wanted to include the most dead-simple exercise possible for the reader to get to byte code on their own. Of course I can use mix, it just adds complexity to the post so I was wondering if there is any way to get the elixir command to write out its .beam files?

$ cat <<EOF > foo.ex
defmodule Foo do
  def foo, do: "foo"
end
EOF
$ elixir --some-option-i-dont-see-in-help foo.ex
$ ls
Elixir.Foo.beam foo.ex

Is there any other way to do this?

I may end up using mix regardless, but I got really curious.

Thanks!

Shouldn’t elixirc foo.ex do exactly that?

1 Like

Ya, I thought it did! I thought I remembered seeing errant .beam files on my machine in the past, but I just tried it today and there was nothing.

Ohhhhhhhhhhhhh elixirC duh :upside_down_face:

Thank you, sir :saluting_face:

3 Likes