简体   繁体   中英

rvm install rails on Mac OSX 10.7.3

was hoping someone could point me in the right direction as I am unable to find a previously posted answer to my question of trying to install rails on my mac mini running Lion OSX 10.7.3. I have ruby version 1.8.7 and rvm 1.12.5 but when I come to install rails using sudo gem install rails I get the following:

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

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.0 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.0/ext/json/ext/parser/gem_make.out

The content of gem_make.out are:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

which did not really help me so not sure what it is I am missing? Any help or directions to help me solve this problem would be appreciated. Many thanks.

rvm is not intended to be used with sudo except during a multi-user installation - try simply gem install rails . Even better, rvm now has a guided rails install,

curl -L get.rvm.io | bash -s stable --rails

Take a look at RVM installation page for more details. If you're still having trouble, post the commands you're trying. The #rvm channel on irc.freenode.net is very helpful too.

In order to build Ruby and many other gems you'll need a working compiler. Unfortunately Apple has made this quite complex so there's a command in rvm to help: rvm requirements

you should not use sudo gem ... it basically looses your environment settings and prevents you from using RVM.

Please follow @tantrix instructions.

Sounds like you'll need to install XCode on your machine to get the necessary header files for building the Rails gem. It's a huge installation, unfortunately.

There was, at one point, a way to load (eg) the stuff on your machine that you need to build Rails without installing XCode, but I can't seem to locate it at the moment.

In my case, I run rvm requirements and it helps me install gcc . But the problem still exists and only solved after I restarted osx.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM