Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Set up Git and Add Gems

Gem Nokogiri error

Getting this error when I try to bundle after saving the new gemfile

Errno::EACCES: Permission denied @ rb_sysopen - /Users/ajnandi/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/nokogiri- An error occurred while installing nokogiri (, and Bundler cannot continue. Make sure that gem install nokogiri -v '' succeeds before bundling.

I then install that gem, but nothing happens and the same error comes up

4 Answers

[Nokogiri Mavericks Fix]

This worked for me:

[Step 1]

Open your terminal and enter this command:

 xcode-select --install

[Step 2]

Make sure you have Homebrew installed like so:

Enter this command on your terminal:

 brew install wget

[Step 3]

Enter this command:

This installs a necessary library for Nokogiri.

brew install apple-gcc42

[Step 4]

Install Nokogiri

sudo gem install nokogiri
Robert Ho
Robert Ho
Courses Plus Student 11,383 Points

try sudo gem install nokogiri -v ''. I feel that it might a problem with the permissions with your folder.

I got this error after trying sudo ...

ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension.

/Users/ajnandi/.rbenv/versions/2.1.2/bin/ruby extconf.rb

Building nokogiri using packaged libraries.

libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

Edward Burton
Edward Burton
8,296 Points

Hi, may be late but I had this issue and it was because I hadn't installed the Xcode command tools mentioned earlier as it didn't error on the creation of odot. I now have a different error but I hope this helps. :)