Can I install global binaries in elixir?

Can I install global binaries with Elixir/Mix like with npm install -g that I can access easily with a global command? how can I create and install one?

Like escripts? Or do you mean mix/iex/etc…?

Not system global, only user global via mix escript.install.

You need to put ~/.mix/escripts into your path to make them invokable without fully qualifying their path and name.

If you want to install them system global, you (your administrator) has to move them manually into the spot where its appropriate for the system. Which I consider a good thing. This makes installation a lot more explicit, and I do not need to elevate tools that run arbitrary code. I do not trust npm or mix (or better, the run build-files) enough to simply sudo them.

1 Like

Ok I see but I can not installit like mix escript.install phoenix for example I have to provide the path to the compressed file

I mean like being able to install phoenix like this:

mix install phoenix and after that use it like a normal CLI

Phoenix is not prepared for that. How to install phoenix generators is described on their webpage.

What would you expect that to do I’m curious? phoenix is a library so using it from the CLI doesn’t seem to make much sense? For servers that are designed to be top level then you build a release with distillery then just unpack it where-ever you want it (mine is hooked into systemd for example).

1 Like