Fl4m3Ph03n1x

Fl4m3Ph03n1x

How to write an Elixir terminal app with `mix release` instead of escript?

Background

I have an elixir app that is a terminal application. After discussions in this forum, it was strongly recommended to me to that I do not use escript and use mix release instead:

So, naturally, now I want to build an elixir app, it can be as simple as an hello world app, that uses mix releases, in terminal.

Problem

The issue here is that all the information I found thus far, all the tutorials (even the ones in this forum) use escript, the exact tool I want to avoid. Therefore I dont know how to build a simple terminal app that when invoked with a parameter returns hello world.

Questions

  • Does anyone know how to build an Elixir app with mix releases that upon execution with a command returns hello world?
  • Is it even possible to have this without escript?

Most Liked

josevalim

josevalim

Creator of Elixir

To be clear, if you want to build a command line app, then by all means, use escript. But if you want a long running system that you are going to deploy in a server somewhere, then releases are a better fit.

Releases are not going to give you a convenient command line API though. The best you can do is to assemble a release and run commands like start, rpc, and eval.

LostKobrakai

LostKobrakai

Even that won‘t help much. Different versions of the same distro are often not compatible with each other.

LostKobrakai

LostKobrakai

Yes and no. Releases need to be build specifically for the architecture of the target system (OS, C ABI, …). This usually doesn’t play nice with how people want to build their terminal applications and is one of the reasons people often suggest to use something else than a beam language to build those.

Where Next?

Popular in Questions Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New

Other popular topics Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

We're in Beta

About us Mission Statement