0

I've been trying to install rails on my macbook, and have been having so much difficulty! I installed RVM, and when I run "gem install rails," I get this message:

gem install rails
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /Users/stephanie/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile

make
/usr/bin/gcc-4.2 -I. -I/Users/stephanie/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin11.4.0 -I/Users/stephanie/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/stephanie/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -DJSON_GENERATOR -I/Users/mpapis/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -I/opt/sm/pkg/active/include -fno-common -pipe -O3 -Wall -O0 -ggdb  -o generator.o -c generator.c
/usr/bin/gcc-4.2 -dynamic -bundle -o generator.bundle generator.o -L. -L/Users/mpapis/.rvm/rubies/ruby-1.9.2-p320/lib -L/Users/mpapis/.rvm/usr/lib -L. -L/opt/sm/pkg/active/lib -L/usr/local/lib -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace  -lruby.1.9.1  -lpthread -ldl -lobjc 
ld: warning: directory not found for option '-L/Users/mpapis/.rvm/rubies/ruby-1.9.2-p320/lib'
ld: warning: directory not found for option '-L/Users/mpapis/.rvm/usr/lib'
ld: warning: directory not found for option '-L/opt/sm/pkg/active/lib'
ld: library not found for -lruby.1.9.1
collect2: ld returned 1 exit status
make: *** [generator.bundle] Error 1

I've tried googling solutions, but haven't found anything. Does anyone have ideas? Thanks!

user
  • 105
  • 2
  • 9
  • 1
    http://stackoverflow.com/questions/9552292/failed-to-build-gem-native-extension – alestanis Oct 29 '12 at 20:59
  • Maybe [this](http://rocksolidwebdesign.com/notes-and-fixes/ruby-xcode/) can help – alestanis Oct 29 '12 at 21:01
  • yep I installed ruby. I'm looking at that site now, thank you! – user Oct 29 '12 at 21:03
  • hmmm downloaded the gcc installer, but still same error :( – user Oct 29 '12 at 21:12
  • The line `library not found for -lruby.1.9.1` does make me think there's a problem with your ruby install – alestanis Oct 29 '12 at 21:29
  • reinstalled ruby and the rails install worked! thank you so much! – user Oct 29 '12 at 21:44
  • Your welcome :) I'll put that on an answer for future reference – alestanis Oct 29 '12 at 22:17
  • Seems like rvm confuses about path. It uses both `/Users/stephanie/.rvm/rubies/ruby-1.9.2-p320` and `/Users/mpapis/.rvm/rubies/ruby-1.9.2-p320`. It should use rvm path under your folder `stephanie`. AFAIK, rvm is should be in sandbox which is accessed by a single user only – kasperite Oct 29 '12 at 22:30

1 Answers1

0

The error you are getting has an interesting line:

ld: library not found for -lruby.1.9.1

This makes me think there is a problem with your ruby install.

It seems there have been issues with Xcode and ruby installs on Mac computers (see this question here, and an article on this over here).

Reinstalling ruby should make thinks work.

Community
  • 1
  • 1
alestanis
  • 21,519
  • 4
  • 48
  • 67