How do I link against the GNU readline library rather than libedit in macosx?

Chris picture Chris · Aug 27, 2011 · Viewed 7.1k times · Source

Attempting to build Term-Readline-Gnu on macosx, fails complaining about libedit and recommending to use gnu readline. How do I do that?

This is one of the attempts I have tried:

First I built GNU libreadline v6.2 statically but did not install it - to make sure I did not screw up the system version with the same name:

./configure --prefix=/Users/Fred/Downloads/tmp1

make

make install-static

Then tried to build Term_Readline-Gnu-1.20

cmc:Term-ReadLine-Gnu-1.20 cmc$ perl Makefile.PL --includedir=/Users/cmc/Downloads/tmp1/include --libdir=/Users/Fred/Downloads/tmp1/lib

Found `/usr/lib/libtermcap.dylib'.

gcc-4.2 -I/Users/Fred/Downloads/tmp1/include -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -DHAVE_STRING_H rlver.c -o rlver -L/Users/Fred/Downloads/tmp1/lib -arch x86_64 -arch i386 -arch ppc -L/usr/local/lib -lreadline -ltermcap

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The libreadline you are using is the libedit library. Use the GNU Readline Library.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Chris

Answer

Mr. L picture Mr. L · Dec 2, 2013

Here is an awesome post explaining how to fix OP's issue in few simple steps:

brew install readline

brew link --force readline

cpanm Term::ReadLine::Gnu

brew unlink readline

Check

brew info readline | head -1