Ardak S
Ardak S

Reputation: 21

How to substitute libedit readline with GNU readline on Mac OS

On my Mac OS (Moneterey 12.1) I see $NetBSD: readline.h, v 1.33 2012/05/15 which I guess is a part of libedit library. I want to use readline.h which is a part of GNU readline library. Is it possible to do that? And what steps should I implement? May be I use some incorrect terminology or misunderstand some concepts. I would appreciate your help.

Upvotes: 0

Views: 760

Answers (1)

Ardak S
Ardak S

Reputation: 21

Well, I found a solution which worked for me. First step, I installed GNU Readline like shown here. In my case I did:

wget ftp://ftp.gnu.org/gnu/readline/readline-8.1.tar.gz
tar xvfz readline-8.1.tar.gz
cd readline-8.1
./configure --prefix=/usr/local/readline/8.1
make
make install

ln -s /usr/local/readline/8.1/include/readline /usr/local/include/

ln -s /usr/local/readline/8.1/lib/libhistory.a /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libhistory.so /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libhistory.so.8 /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libhistory.so.8.1 /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libreadline.a /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libreadline.so /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libreadline.so.8 /usr/local/lib/
ln -s /usr/local/readline/8.1/lib/libreadline.so.8.1 /usr/local/lib/

Then I reisntalled Ruby and compiled it with GNU readline, like discussed here:

rvm get head
rvm reinstall ruby --disable-binary --with-opt-dir=$(brew --prefix readline)

Finally when compiling my project I used -lcurses option ( -lreadline -lcurses) as discussed here.

Upvotes: 1

Related Questions