Enabling history in the Elixir's Interactive Shell (IEx)

almirsarajcic

almirsarajcic

Created 1 month ago

Do you miss your favorite shell’s ability to remember commands you executed in the last shell session when using IEx? When you just start iex and press the up arrow, nothing happens. Well, you can fix that simply by changing an environment variable.

Add the following to your ~/.bashrc or ~/.zshrc file:

export ERL_AFLAGS="-kernel shell_history enabled"

like this:

echo "\nexport ERL_AFLAGS=\"-kernel shell_history enabled\"" >> ~/.zshrc
source ~/.zshrc
iex

and start writing history.