Why doesn't `mix run` just call `mix deps.get`?

When I try to run my applications and I haven’t updated the dependencies, the output tells me to run mix deps.get.

Why doesn’t the binary just do that instead of ask me for it?

This is a discussion of the Pros/Cons of both automatically running mix deps.get and requiring the developer to manually run the Mix task.

I’d personally be ok with mix run calling mix deps.get if the deps weren’t present and it notified the user first


I prefer to have full controll over what happens when.

Sometimes I am simply offline, and when I do eg. a cargo build or rebar3 build they error out with a huge complain about beeing unable to load their deps. This is annoying. I knew in advance that I’m offline, you don’t need to tell me. If though you had told me that dependencies are missing and I need to call something else to download them, I had the option the choose between using a mobile connection to download them or to do something else.

Also both tools I mentioned, do not have an actual task to trigger just the download of deps, without anything else. This is also problematic when building containers with some things cached, and requires some nasty hoops to jump through.


Running mix deps.get does have the sideeffect of adding new versions to mix.lock for dependencies not present before. Personally I like that this does not happen for commands, which might not be expected to cause sideeffects.


In at least 99% of cases I run mix deps.get after a command crashes due to outdated deps. For me personally and the way that I work, it is just bothersome to have to run it manually.

However, I believe that there are valid reasons not to do it automatically. So maybe instead of failing due to outdated deps, it could ask whether or not to get the deps? And maybe this could be configurable (always yes, always no)?

1 Like