Setting erlang vm arguments in development

I need to set the multi_time_warp vm argument in my development environment (using the mix tool). Is there a way I can do this ?

1 Like

Great question!

Doing this for production systems is straightforward and well-documented. Both Elixir’s new built-in releases and the older Distillery-based releases allowed you to specify a ‘vm.args’ file with arguments to provide to the Erlang virtual machine at startup. For more information about this, see the configuring releases page of the Mix documentation.

Unfortunately, this does not help you in development. In all environments, iex and similar commands that start a BEAM instance will listen to the options given in the environment variable ELIXIR_ERL_OPTIONS.

I was however looking for a way to specify these options in e.g. the mix.exs file of a project, and as far as I could find (maybe I missed something), there is no way to do this.
One thing you might want to do is to create a .iex.exs file for development, maybe?

1 Like

There is no way to do this for the same reason it is not possible to change any of the kernel options via the config.exs - everything is up and running before this file is parsed, the same goes with ELIXIR_ERL_OPTIONS.

1 Like

Hey :wave:
A bit late, but a colleague of mine were able to tweak the VM in development by setting the --erl argument when starting the interactive shell, for example:

iex --erl "-kernel +MIscs 2048" -S mix phx.server

(:point_up: this will increase the change reserved for literal_alloc)

Which is basically the same approach suggested by the official guide for enabling the shell history:

iex --erl "-kernel shell_history enabled"

For the sake of completeness, you can also export the ERL_AFLAGS environment variable to achieve the same result.