I have recently switched from Ubuntu to Manjaro 24.0. I have come across a strange issue with iex and erl. When I run either of them the arrow keys are not being picked up, I am unable to scroll through the command history or move the cursor left or right. I have figured out that the version of Erlang / OTP matters. Any version prior to 26.1 seems to exhibit this behaviour. Anything after that and the arrow keys work as normal in iex / erl.
I have tried using gnome-terminal, alacritty and urxvt but all of the terminals behave the same. I tried connecting to a server that is running OTP 25.0.2 and Elixir 1.13.4-otp-25 and even when connected to a remote console it still does not recognize the keys.
I have googled around and found the suggestion of adding ERL_AFLAGS='-kernel shell_history enabled' to the environment but this does not fix the issue. Other suggestions were to set my TERM environment to TERM=vt100 or TERM=xterm-256color but this did not help either.
I have exhausted all avenues that I can think of. Has anyone experienced this or have any idea why it might happen? Let me know if I can provide more details that may help.
AFAIK the library that handles the fancy input/output options in Linux is “libreadline” and what I think may be happening is that you did not have package called “libreadline-dev” (or similar) installed when you compiled Erlang. I am not 100% sure, but try the following:
Search the package manager for libreadline and libreadline-dev and install the packages you find. May be multiple ones like libreadline6-dev or so, this varies between distributions and I did not use Manjaro in a while.
Remove your Erlang installation completely
Re-install Erlang
Again, this would be happening if you had erlang built from scratch, i.e. installed through kerl or asdf that compiled it without libreadline-dev present. If you have installed a binary Erlang package, this should not be happening.
I do have shell history in both zsh and bash. This issue is still present in both shells.
I have installed readline and its development packages. I have also made sure ncurses. Still not recognizing the arrow keys. I am using asdf to install erlang, I have uninstalled and reinstalled. I have installed every version from 27.0.1 down to 25.0.2 and tested each version. Anything from 26.1 onwards the arrow keys work fine.
It is very strange. Hopefully I can figure this out. Again if anyone has any insight it would be much appreciated!