views:

163

answers:

3

I am just getting started learning rails.

I am building my first app using Ruby on Rails tutorial by Michael Hartl.

the book said to use this gem file.

source 'http://rubygems.org'

gem 'rails', '3.0.0.rc'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'

group :development do
     gem 'rspec-rails', '2.0.0.beta.18'
end

group :test do
     gem 'rspec', '2.0.0.beta.18'
end

However I get the following error when I run bundle install in the terminal:

Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0.rc) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0.rc) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.4) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0.rc) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.6.1) 
Using actionmailer (3.0.0.rc) 
Using arel (0.4.0) 
Using activerecord (3.0.0.rc) 
Using activeresource (3.0.0.rc) 
Using bundler (1.0.0) 
Using diff-lcs (1.1.2) 
Installing nokogiri (1.4.3.1) with native extensions /Library/Ruby/Site/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/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
+2  A: 

Paths suggest you are using a Mac, right? Maybe this answer solves your problem?

http://stackoverflow.com/questions/1366746/gem-install-mysql-failure-in-snow-leopard

Error looks the same. Accepted answer said that "Installing the Xcode that's bundled with the Snow Leopard fixed the problem."

mdrozdziel
Worked like a charm
Alex
A: 

Are you on Linux? Here is a list of common problems you might run into when installing stuff in Ubuntu Linux - http://rbjl.net/20-rubybuntu-2-troubleshooting-common-ruby-ubuntu-problems

I am on Linux and had to do the following to get nokogiri to install:

sudo apt-get install libxml2 libxml2-dev libxslt1-dev
gem install nokogiri (remember to use sudo if you are not using RVM)
stephenmurdoch
A: 

Just FYI, Rails 3.0 was released on August 29. So you can use

gem 'rails', '3.0.0'
Vincent