Phoenix or elixir M1 computer -S : Could not find executable mix

Today tried to install elixir and phoenix in Apple M1 computer. Elixir was installed through brew.
A phoenix app was created which could be started with “mix phx.server”, but when call “iex -S mix phx.server”, I got:

Erlang/OTP 27 [erts-15.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

-S : Could not find executable mix

Elixir 1.18.2 (compiled with Erlang/OTP 27)

BTW I GOT the warning message when installed phoenix
like the reported one Warning Message when installing Phoenix 1.7.19 · Issue #6069 · phoenixframework/phoenix · GitHub

Any thoughts?

Thanks

iex -S mix phx.server what you meant?

Running phoenix app in IEx (Interactive Elixir) so that I can interact with the app.

Above you typed mix -S mix and not iex -S mix just making sure it is a typo here or if that is your problem?

Sorry. Corrected. I did try “iex -S mix phx.server”

What does your $PATH look like?

I can see mix in the PATH:
/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/opt/postgresql@17/bin:/opt/miniconda3/bin:/opt/miniconda3/condabin:/Users/qxu/opt/homebrew/bin/mix:/opt/homebrew/opt/postgresql@17/bin:/Users/qxu/opt/homebrew/bin:/Users/qxu/opt/homebrew/Cellar/erlang/27.2.1/lib/erlang/erts-15.2.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.13/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:

The recommended way to use elixir/erlang is by installing them with asdf or mise.

I would strongly recommend to remove the versions installed with brew and install them properly.

The latest erlang/elixir versions are:

  • elixir 1.18.2
  • erlang 27.2.2

PS: Erlang is compiled from source when installed with these managers, so make sure to read logs for missing tools required to compile it from source.