Tried to install Elixir but my system has no mix command

I have run the installation instructions found in the Blockscout recipe. But my system has no mix command, so clearly something is missing.

1 Like

Welcome to the Elixir forum. The is a wonderful community but there is an expectation that you first help yourself. What have you tried? Have you consulted the official Elixir installation page?

1 Like

Hi @llivingston can you provide a link to this guide you’ve followed?

1 Like

You are much better off installing Erlang and Elixir through asdf. After you do that, set up global and/or local (inside a project dir) versions and you should be good to go.

Oh, and to have the necessary tooling for downloading dependencies you should also run this after successful installations: mix local.rebar --force && mix local.hex --force.

6 Likes

I use asdf as well! It really helps pin the version to whatever we want for reproducible builds.

Here are the commands I use:

brew install asdf

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git

asdf install

mix do local.hex, local.phx

asdf reshim elixir

Here’s the content of .tool-versions file, that needs to be in root of your project folder, for asdf to read:

elixir 1.14.0-otp-25
erlang 25.1.1

P.S. Mix is a build tool that ships with Elixir that provides tasks for creating, compiling, testing your application, managing its dependencies and much more!!

3 Likes

Agree about asdf, if you’re on a Mac this guide may help :023:

3 Likes

better:

mix do local.hex, local.rebar, local.phx

3 Likes

asdf has been my savior this past year. I even got elixir and Erlang up and running on my tablet with termux.

2 Likes

Hehe, I already have it.

I removed it from this post for brevity. :upside_down_face:

From the install instructions for blockscout, I’m at the point where I’m supposed to execute the following:
mix do deps.get, local.rebar --force, deps.compile

This is what I get:

** (EXIT from #PID<0.94.0>) an exception was raised:
    ** (UndefinedFunctionError) function :erlang.get_stacktrace/0 is undefined or private
        :erlang.get_stacktrace()
        (elixir) lib/kernel/cli.ex:118: anonymous fn/3 in Kernel.CLI.exec_fun/2

Did you follow the asdf steps shown above?

I did, which is how I finally got the mix command

You’re better off uninstalling anything system-wide that relates to Erlang and Elixir and only use asdf. It should work right away afterwards.

2 Likes