gak
gak

Reputation: 32783

Is it possible to use readline instead of libedit in Python's raw_input under OS X?

From the readline module documentation, it mentions:

On MacOS X the readline module can be implemented using the libedit library instead of GNU readline. The configuration file for libedit is different from that of GNU readline.

Is it possible to use the readline library in /usr/lib/libreadline.dylib for example, or even compiled with MacPorts or Homebrew?

Upvotes: 3

Views: 2692

Answers (2)

gak
gak

Reputation: 32783

$ sudo easy_install readline

Upvotes: 3

Ned Deily
Ned Deily

Reputation: 85095

It is possible to use GNU readline from MacPorts or elsewhere when building Python by specifying the additional library and include files when invoking the configure script. See the python installer build script in the Python source tree (Mac/BuildScript/build-installer.py) for an example. It builds a local copy of GNU readline when building for targets of 10.4 or earlier.

Keep in mind that on current OS X releases, /usr/lib/libreadline.dylib is merely a symlink to libedit; AFAIK, Apple does not ship GNU readline as a library in OS X:

$ ls -l /usr/lib/libreadline.dylib 
lrwxr-xr-x  1 root  wheel  15 Sep  5  2009 /usr/lib/libreadline.dylib@ -> libedit.2.dylib

Upvotes: 2

Related Questions