I wouldn’t do it. Elixir/BEAM is great, but they have a context in which they shine. CLI tools are not one of them. I don’t say sadly, because IMO this allows them to be better at things they are designed to do.
Yes, you can do it. Look into escript (check your own Mix version using mix -v and select it in docs). Alternatively, look at this list or even this.
It looks harder than other languages probably, and I think that was a design choice.






















