Reputation: 2741
I'm getting this when trying to install rails using: gen install rails
I barely have any idea what I'm doing :/ Trying to learn :)
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.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
Thanks in advance!
I've tried following directions here (http://rubyonrails.org/download) and here (http://rubygems.org/pages/download).
Upvotes: 1
Views: 374
Reputation: 1844
I'm going to assume that you're new to Ruby as well, just in case doing so can help others who need this answered. Please don't take offense.
It looks like your installation of Ruby is out of date or broken. Mac OSX comes with a default Ruby installed, but I honestly have no idea if it's complete or out of date because I always install my own.
By default, MacOSX does not have the capacity to build C applications, which is what the "standard" ruby runtime is. So, you need to install a C building toolchain, which in many cases is GCC & friends.
Once you've installed them, close any open terminal windows before proceeding to ensure that the build tools are in your path.
There are a few ways to get Ruby going on a new linux system, but the most widely recommended one is to use rvm.
RVM is a tool which helps install and manage different Ruby environments, so you can easily switch between them and upgrade (or downgrade for a specific project or issue). It's found here (direct link to the installation instructions) You most likely want to do the first of the Quick guided installs, which will simply install it for your user. It'll also install the latest stable version of ruby.
There is a GUI for installing RVM, called JewelleryBox. It's fairly pretty and will notify you when there's new versions.
Once the app itself is installed:
Ruby's almost ubiquitous means of fetching libraries, including Rails, is with rubygems and the gem
command. In this case, gem install rails
should get you started. Oh, and make sure you open a new terminal window after installing a new ruby, and check it's installed with ruby -v
.
Bundler is a neat package manager built on top of rubygems. Install it with gem install bundle
(oh, and Rails will install it as a dependancy). Its got its docs at this link but for basic, raw rails, you shouldn't need to do anything with it.
Have a blast learning Rails, I hope you find it makes webapp development more fun for you ^_^
Upvotes: 3
Reputation: 1305
Firstly create a rvm
version with ruby version.
And create a gemset with some name under that rvm.
Do gem install bundler
before installing any thing.
Then install rails with gem install rails
which installs the latest version of rails.
And go ahead.
Upvotes: 0
Reputation: 4967
I tried for a long time to get Rails running smoothly on Mac OS X and the best solution I could find was installing through JewelryBox.
Upvotes: 2
Reputation: 34657
Do you have the file
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
cause I don't and I'm on Mac OS X as well...
Upvotes: 0