Installing R on OS X with Readline

Posted 03 Jan 2011 to r, os x and has Comments

When attempting to install R on OS X with homebrew I ran into the following error:

checking for history_truncate_file... no
configure: error: --with-readline=yes (default) and headers/libs are not available
Exit status: 1

Turns out there is an issue with the default Mac readline lib being old and moldy. While you can compile without readline support, that makes the read-eval-print loop really hard to interact with. To fix the problem, you need to add readline as a dependency and change the CPPFLAGS and LDFLAGS environment variables to look in the right directory. Type:

brew edit R

and then add the depends line and the environment variable lines as shown in:

After that, save and close the file, and then you should be good to go:

brew install R