Erlang :dbg missing when I start with iex -S mix

Greetings,

When I start an interactive shell with
iex
I have access to Erlang dbg (:dbg).
When I start with
iex -S mix
:dbg is not available.
I think I am missing something in mix.exs.
The app is created with
mix new app
I have not edited anything.

% iex --version
IEx 1.15.4 (compiled with Erlang/OTP 26)
% mix --version
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Mix 1.15.4 (compiled with Erlang/OTP 26)

What am I doing wrong?

$ iex
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :dbg.h
The following help items are available:
   p, c
       - Set trace flags for processes
   tp, tpl, ctp, ctpl, ctpg, ltp, dtp, wtp, rtp
       - Manipulate trace patterns for functions
   n, cn, ln
       - Add/remove traced nodes.
   tracer, trace_port, trace_client, get_tracer, stop, stop_clear
       - Manipulate tracer process/port
   i
       - Info

call dbg:h(Item) for brief help a brief description
of one of the items above.

:ok

OTP26 is fine too

$ iex
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :dbg.h
The following help items are available:
   p, c
       - Set trace flags for processes
   tp, tpl, ctp, ctpl, ctpg, ltp, dtp, wtp, rtp
       - Manipulate trace patterns for functions
   n, cn, ln
       - Add/remove traced nodes.
   tracer, trace_port, trace_client, get_tracer, stop, stop_clear
       - Manipulate tracer process/port
   i
       - Info

call dbg:h(Item) for brief help a brief description
of one of the items above.

:ok

Nothing, but the OP asks for :dbg after starting with iex -S mix

Reproduced here FWIW.

Maybe a clue that helps, it is available in a new Phoenix app.

Add :runtime_tools to :extra_applications in mix.exs.

EDIT: Oh, sorry, that is what you were implying, @smathy :sweat_smile:

3 Likes

Yes, that’s it…

No, you give me too much credit, I didn’t know the solution off hand just happened to check in a phoenix console and noticed it worked there.

1 Like

Thank you. Adding :runtime_tools to extra_applications: solved it.
I tried adding :dbg to extra_applications: and that did not help. Should have kept trying.