NullVoxPopuli
NullVoxPopuli

Reputation: 65143

RVM won't install ruby - I even downgraded to XCode 4.1 - Error pertains to readline

Here is what I did:

$ rvm install ruby-1.8.7-p352

Installing Ruby from source to: /Users/me/.rvm/rubies/ruby-1.8.7-p352, this may take a while depending on your cpu(s)...

ruby-1.8.7-p352 - #fetching 
ruby-1.8.7-p352 - #extracted to /Users/me/.rvm/src/ruby-1.8.7-p352 (already extracted)
Applying patch 'stdout-rouge-fix' (located at /Users/me/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch)
ERROR: Error running 'patch -F25 -p1 -f <"/Users/me/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch"', please read /Users/me/.rvm/log/ruby-1.8.7-p352/patch.apply.stdout-rouge-fix.log
Applying patch 'no_sslv2' (located at /Users/me/.rvm/patches/ruby/1.8.7/no_sslv2.diff)
ruby-1.8.7-p352 - #configuring 
ruby-1.8.7-p352 - #compiling 
ERROR: Error running 'make ', please read /Users/me/.rvm/log/ruby-1.8.7-p352/make.log
ERROR: There has been an error while running make. Halting the installation.

Here is the contents of the first error log, patch.apply.stdout-rouge-fix.log:

[2012-02-02 14:08:02] patch -F25 -p1 -f <"/Users/me/.rvm/patches/ruby/1.8.7/stdout-rouge-fix.patch"
patching file lib/mkmf.rb
Hunk #1 FAILED at 201.
1 out of 1 hunk FAILED -- saving rejects to file lib/mkmf.rb.rej

And then the last few lines from make.log

compiling readline
/usr/bin/gcc-4.2 -I. -I../.. -I../../. -I../.././ext/readline -DHAVE_READLINE_READLINE_H -DHAVE_READLINE_HISTORY_H -DHAVE_RL_FILENAME_COMPLETION_FUNCTION -DHAVE_RL_COMPLETION_MATCHES -DHAVE_RL_DEPREP_TERM_FUNCTION -DHAVE_RL_COMPLETION_APPEND_CHARACTER -DHAVE_RL_BASIC_WORD_BREAK_CHARACTERS -DHAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -DHAVE_RL_BASIC_QUOTE_CHARACTERS -DHAVE_RL_COMPLETER_QUOTE_CHARACTERS -DHAVE_RL_FILENAME_QUOTE_CHARACTERS -DHAVE_RL_ATTEMPTED_COMPLETION_OVER -DHAVE_RL_LIBRARY_VERSION -DHAVE_RL_EVENT_HOOK -DHAVE_RL_CLEANUP_AFTER_SIGNAL -DHAVE_REPLACE_HISTORY_ENTRY -DHAVE_REMOVE_HISTORY  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -g -O2  -fno-common -pipe -fno-common   -c readline.c
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
make: *** [all] Error 1

So, then I though, hey! readline, other people were having issues with that... So, I should install the package for it first with rvm, before trying to install ruby.

I did

rvm pkg install readline

this worked fine.

And then I did

rvm reinstall 1.8.7, and still got an error, this time only one. still relating to readline.

So, I then tried this:

 rvm reinstall 1.8.7 --with-readline-dir=$rvm_path/usr

And now everything works.

So.. this isn't really a question, so much as it is THE way to fix Mac Lion and RVM issues

Upvotes: 2

Views: 1202

Answers (1)

NullVoxPopuli
NullVoxPopuli

Reputation: 65143

in short, the solution is this:

rvm pkg install readline

rvm reinstall 1.8.7

rvm reinstall 1.8.7 --with-readline-dir=$rvm_path/usr

Upvotes: 4

Related Questions