Installing nokogiri Mac OS X 10.8.2 XCode installed
After short research I find out what problem can be simply solved by creating symbolic link
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
works for me hope for you too
gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/morozovm/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for libxml/parser.h... *** extconf.rb failed ***
bash-3.2$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Password:
bash-3.2$ gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.6
1 gem installed
Mountain Lion - LibXML & Nokogiri
Putting gem 'nokogiri'
above gem 'pg'
in my Gemfile fixed this for me.
My Gemfile didn't have nokogiri in it, but it was a dependency that was in Gemfile.lock, so I put it in my Gemfile explicitly.
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
I have found some fixes for Lion, but none for Mountain Lion yet. Nonetheless I have tried this and it works:
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link libxml2
brew install libxslt
brew link libxslt
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
Source (for Lion): https://gist.github.com/1349681
Bundle update & install fail after OS X lion upgrade - Rails 3
Make sure to install XCode. Install it from the App Store, but also run "Install Xcode" from the Applications folder.
Related Topics
Rails: Url/Path with Parameters
Limiting Characters/Words in View - Ruby on Rails
How to Remove All Elements That Satisfy a Condition in Array in Ruby
"Use" Keyword/Word in Ruby/Rails/Rack Code
Rspec Testing Has_Many :Through and After_Save
Activeadmin Forbiddenattributeserror
Does Activemerchant Support Subscription Based Transaction
Sending a Delete Request from Sinatra
Ruby Imap Idle Concurrency - How to Tackle
Decoding Facebook's Signed Request in Ruby/Sinatra
Error: While Executing Gem ... (Typeerror) Incompatible Marshal File Format (Can't Be Read)
Carrierwave Fog Amazon S3 Images Not Displaying
Connecting to Oracle Db Using Ruby
Paperclip: Upload from Url with Extension