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

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
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
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
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
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement