Ruby does not work on OSX Lion with rbenv

I am trying to install Ruby on my Lion computer (OSX 10.7.3).

I installed rbenv and ruby-build and am trying to get 1.9.2-p290 on my machine. Here is the result of the installation failure:

$ rbenv install 1.9.2-p290 Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz... Installing yaml-0.1.4... Installed yaml-0.1.4 to /Users/CSC/.rbenv/versions/1.9.2-p290 Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz... Installing ruby-1.9.2-p290... BUILD FAILED Inspect or clean up the working tree at /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239 Results logged to /var/folders/vm/gcqcld015jx025m7qgtxvw0m0000gn/T/ruby-build.20120301140751.6239.log Last 10 log lines: /usr/bin/gcc-4.2 -I. -I../../../.ext/include/x86_64-darwin11.3.0 -I../../.././include -I../../.././ext/racc/cparse -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -o cparse.o -c cparse.c /usr/bin/gcc-4.2 -dynamic -bundle -o ../../../.ext/x86_64-darwin11.3.0/racc/cparse.bundle cparse.o -L. -L../../.. -L. -L'/Users/SamCouch/.rbenv/versions/1.9.2-p290/lib' -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -lpthread -ldl -lobjc compiling readline /usr/bin/gcc-4.2 -I. -I../../.ext/include/x86_64-darwin11.3.0 -I../.././include -I../.././ext/readline -DRUBY_EXTCONF_H=\"extconf.h\" -I'/Users/SamCouch/.rbenv/versions/1.9.2-p290/include' -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -o readline.o -c readline.c readline.c: In function 'username_completion_proc_call': readline.c:1386: error: 'username_completion_function' undeclared (first use in this function) readline.c:1386: error: (Each undeclared identifier is reported only once readline.c:1386: error: for each function it appears in.) make[1]: *** [readline.o] Error 1 make: *** [mkmain.sh] Error 1 

I tried to fix the problem, but so far I have not found a solution:

 $ which gcc /usr/bin/gcc $ gcc i686-apple-darwin11-llvm-gcc-4.2: no input files $ ruby-build ruby-build 20120216 usage: ruby-build [-v|--verbose] definition prefix ruby-build --definitions 

Any help would be greatly appreciated!

As a note, I tried other similar offers posted here and no one worked for me.

+7
source share
4 answers

In ruby-build issue # 130, the current workaround is:

env CC=/usr/bin/gcc rbenv install 1.9.3-p125

I just successfully tested this on a system with:

  • OS X 10.7.3
  • Xcode 4.3.1
  • Xcode command-line tools installed (via Xcode> Settings> Downloads)
  • ruby-build @ fbfa944
  • rbenv @ 975b45d

In addition, pending pullback request # 137 aims to correct this upstream once and for all.

FWIW, many people have been shaking out problems with the build chain since Xcode 4.3.x since it came out. Expect some instability in any system if you upgrade to a new tool chain until the total dust falls.

+16
source

There seem to be two or three error-related questions using rbenv to install ruby ​​1.9.x on Mac OS X via homebrew / rbenv , and I tried the solutions for many of them without luck. Installing the compiler and installing the Apple gcc42 compiler using homebrew did not help ( brew install apple-gcc42 and CC=/usr/bin/gcc - no luck), so I'm not sure if they are needed. I am using the rbenv manager and therefore it helped me with installing 1.9.3-p385

The problem is that the readline is displayed as a log:

 readline.c: In function 'username_completion_proc_call': readline.c:1499: error: 'username_completion_function' undeclared (first use in this function) readline.c:1499: error: (Each undeclared identifier is reported only once readline.c:1499: error: for each function it appears in.) 

Therefore, looking specifically at this error, I found a solution:

Decision:

 brew install readline CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p385 

You can indicate that part of the rbenv install 1.9.3-p385 matches any latest version or that you are trying to install. A note was found on this blog .

+5
source

This may answer the level of what you need, and not what you directly ask, but: did you just consider using macports (see macports.org) or brew as a way to install ruby ​​1.9? It works very well and with much less effort.

0
source

This is not exactly what you asked for, but " Unable to install Ruby under Lion with RVM-GCC problems ." How to get Ruby working on Lion with RVM. The errors are pretty similar, so you can:

Use them for some rbenv troubleshooting tips or just use RVM as described in the top answer to install Ruby this way. It seems to me that this is an easier method.

0
source

All Articles