Elixir trick: start an Observer window with mix

Published on
Tagged with featured elixir16

Yesterday I wanted to monitor the processes that my Elixir application was spawning.

I knew there was something called Observer, but couldn’t remember exactly how to do it.

Taking a look at the doc, I found this debugging page that mentioned :observer.start().

The suggested usage was with iex -S mix and then running :observer.start() in the mix shell manually.

I don’t like manual things that much.

You can achieve the same, if you need to run your app with mix run --no-halt in the following way:

mix run --no-halt --eval ":observer.start"

This will run your app (without halting) and spawn a process monitor window!

Alternatively, you can achieve the same using IEx:

iex --eval ":observer.start" -S mix

If you’re interested, here the repo where I needed the process monitor:


elixir process monitor


As suggested by Aleksei on Twitter you could do something like to always, automatically start the observer window, and have IEx functionality at the same time:

echo ':observer.start()' >> .iex.exs

Then, you can run your usual iex -S mix and enjoy process monitoring!

Here, have a slice of pizza 🍕