Problem with irb on OS X

I run Tiger on a Macbook. I installed Ruby and Rails by the DarwinPorts
method. I tried to run irb, and I get the following:

Macbook:~ aaron$ irb
dyld: NSLinkModule() error
dyld: Library not loaded: /opt/local/lib/libreadline.5.0.dylib
  Referenced from: /opt/local/lib/ruby/1.8/i686-darwin8.6.2/readline.bundle
  Reason: image not found
Trace/BPT trap

It turns out that readline is installed.

Macbook:~ aaron$ sudo port installed readline
Password:
The following ports are currently installed:
  readline @5.0.005_0+darwin_8
  readline @5.1.004_0 (active)
Macbook:~ aaron$

But when I try to uninstall either version, to reinstall it... they both say
they depend on ruby and postgresql8. So I'm stuck.

Any ideas?

Thanks,

Aaron Kulbe
SuperLag - irc.freenode.net

The problem is that ruby was compiled when readline 5.0 was installed so it links against the 5.0 dylib. There are several ways to fix it:

1) Uninstall ruby and recompile it. Now it will find that readline 5.1 is installed and link against it
2) Make a symbolic link like so:

sudo ln -s /opt/local/lib/libreadline.5.1.dylib /opt/local/lib/libreadline5.0.dylib

Now it will find the dylib and hopefully it will work.

Solution 1) is cleaner but solution 2) is faster.

BTW: If you want to uninstall a port and you are really sure what you are doing you can do 'port -f uninstall <portname>'.

Urban
- --
http://bettong.net - Urban's Blog

···

On 18 Jun 2006, at 08:04, Aaron Kulbe wrote:

Macbook:~ aaron$ irb
dyld: NSLinkModule() error
dyld: Library not loaded: /opt/local/lib/libreadline.5.0.dylib
Referenced from: /opt/local/lib/ruby/1.8/i686-darwin8.6.2/readline.bundle
Reason: image not found
Trace/BPT trap

It turns out that readline is installed.

Macbook:~ aaron$ sudo port installed readline
Password:
The following ports are currently installed:
readline @5.0.005_0+darwin_8
readline @5.1.004_0 (active)
Macbook:~ aaron$

But when I try to uninstall either version, to reinstall it... they both say
they depend on ruby and postgresql8. So I'm stuck.