RVM on OSX Snow Leopard & readline errors

Posted by – March 19, 2010

There seems to be an issue with the system readline utility which prevents Rubies installed by rvm from being compiled. A possible fix to this is to install your own version of readline.

Errors in the make log:

readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: error: (Each undeclared identifier is reported only once
readline.c:730: error: for each function it appears in.)
make[1]: *** [readline.o] Error 1

Your own readline

Compile and install your own readline:

curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.1.tar.gz
tar xzvf readline-6.1.tar.gz
cd readline-6.1
./configure --prefix=/usr/local
make
sudo make install
cd ..

Give rvm another try …

First you have to remove Ruby versions you tried to compile before:

rvm remove 1.9.1

The following command with a reference to the newly installed newline should do the job:

rvm install 1.9.1 -C --with-readline-dir=/usr/local/

18 Comments on RVM on OSX Snow Leopard & readline errors

  1. till says:

    That is ist. RVM is working great now. Thanks a lot.
    -Till

  2. Russ McBride says:

    Sweeeet! This is a quality of life improving post. That was an annoying problem, and compiling readline into the rvm directory as suggested in the rvm docs didn’t help.

  3. Barrett says:

    I fought with this for nearly a day before I found this. Worked like a champ for reinstalling 1.9.1p-0 and 1.9.1-p378 after I upgrading to Snow Leopard. Boy has _that_ been a fun cycle of recompiling lots of stuff!

  4. Ed says:

    You have been a much better solution to this problem than anyone else, including the rvm folks. Thanks a lot

  5. Steve says:

    That worked for ruby 1.8.8 too. Thanks for the post!

  6. Michael says:

    This fixed both 1.8.7 and 1.9.2 for me — thanks Niwo!

  7. Sev says:

    Yay! Works.

  8. Rob S. says:

    Perfect man, RVM + REE on Snow Leopard, working great! Thanks :)

  9. Eric Paxton says:

    Thanks alot! New to the Ruby community. This helped me get both two versions of rails installed.

  10. Sebastian says:

    Awesome, this solved my problem!

  11. Manuel says:

    Great! I’ve spent hours trying to install ruby via rvm until I stumbled upon your solution!
    Thanks a lot!

  12. Ron says:

    Thanx, relieved the aggravation… working like charm now.

  13. Richard says:

    Thanks for the post, any clue if you can set –with-readline-dir=/usr/local/ as a default flag with rvm?

  14. Steve says:

    OMG – this problem has kept me out of action for weeks. Wish I’d seen this post earlier! 1.8.7 under RVM is now working again. Thanks heaps!

  15. Joe says:

    Rails and ruby seems to get worse every release – along with minor tweaks to make all previous scripts break. Thanks for this, kept me from descending further into the inferno.

  16. Dave says:

    Thanks! Worked well for 1.8.7 (and jruby, though I didn’t try to install jruby without the readline switch).

  17. Oinak says:

    No luck with this on Lion:

    I got this

    gcc-4.2 -dynamic -arch_only `/usr/bin/arch` -install_name /usr/local/lib/libreadline.6.1.dylib -current_version 6.1 -compatibility_version 6 -v -o libreadline.6.1.dylib readline.so vi_mode.so funmap.so keymaps.so parens.so search.so rltty.so complete.so bind.so isearch.so display.so signals.so util.so kill.so undo.so macro.so input.so callback.so terminal.so text.so nls.so misc.so xmalloc.so history.so histexpand.so histfile.so histsearch.so shell.so mbutil.so tilde.so compat.so -lncurses
    Using built-in specs.
    Target: i686-apple-darwin11
    Configured with: /private/var/tmp/gcc/gcc-5666.3~278/src/configure –disable-checking –enable-werror –prefix=/usr –mandir=/share/man –enable-languages=c,objc,c++,obj-c++ –program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ –with-slibdir=/usr/lib –build=i686-apple-darwin11 –program-prefix=i686-apple-darwin11- –host=x86_64-apple-darwin11 –target=i686-apple-darwin11 –with-gxx-include-dir=/include/c++/4.2.1
    Thread model: posix
    gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
    i686-apple-darwin11-gcc-4.2.1: -compatibility_version only allowed with -dynamiclib
    make[1]: *** [libreadline.6.1.dylib] Error 1
    make: [shared] Error 2 (ignored)

  18. Grant Morgan says:

    I had same problem as above user. I tried using v 6.2 but solution is at
    http://www.iamseree.com/application-development/readline-6-2-make-error-in-mac-os-x-lion

    —–
    curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.2.tar.gz
    tar xzvf readline-6.2.tar.gz
    cd readline-6.2
    ./configure –prefix=/usr/local
    cd shlib
    sed -e ‘s/-dynamic/-dynamiclib/’ Makefile > Makefile.good
    mv Makefile.good Makefile
    cd ..
    make
    sudo make install
    make
    sudo make install
    cd ..

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">