Readline Problems With Ruby on OSX

Fri Mar 1, 2019
~200 Words

A recurring issue with running a Ruby development environment on OSX is integrations with external libraries, particularly readline. As various elements of the setup evolve (e.g. OSX, Homebrew, Ruby, rbenv) breakage occurs which causes development time to be spent debugging basic machine issues.

The relevant error message and failure, issued by byebug was:

Sorry, you can't use byebug without Readline. To solve this, you need to rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get install libreadline-dev` and then reinstall your Ruby.

In the top search hit for this issue, which dates from over two years ago at time of writing the most popular solution is to manually symlink the libreadline dylib. This is not a sustainable solution and risks breaking other software on the machine.

To resolve this issue I reinstalled the Ruby version which had the issue:

rbenv uninstall 2.5.3
rbenv install 2.5.3

Running gem pristine --all before that did not resolve the issue.

For a longer-term fix we are experimenting with including the rb-readline gem in the development group of our Gemfile.

Did you find this post useful? If you would like help with anything then you can contact me any time via Twitter.