简体   繁体   中英

Error installing Rails on Mac OX Lion

I get this error when I try to install Rails on my Mac OS Lion. I used the command - $ sudo gem install rails

/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

Any steps I need to follow to install rails?

Thanks

Just avoid using the bundled ruby, which is 1.8 and it is really outdated. Install rvm which will provide an up-to-date ruby version and then everything will work seamlessly. This is the only thing you need to start:

$ curl -L https://get.rvm.io | bash -s stable --rails

You will need the gcc/g++ toolchain (Xcode) to build everything but you would have needed it in anycase to compile any native gem.

It looks like you're missing some header files - try reinstalling XCode and the developer tools. If you already downloaded XCode, make sure you've run the installer that it put into /Applications for you.

Like Jack says, using rvm will be a lot smoother.

Mac OS中的Ruby系统已过时,建议您安装RVMRbenv来管理已安装的Rubies或安装新版本。

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