开发者

Problems installing Nokogiri

I'm following this tutorial and I've come to where I need to install these gems:

gem 'rails', '3.0.3'

gem 'sqlite3-ruby', :require => 'sqlite3'

group :development do
  gem 'rspec-rails', '2.0.1'
end

group :test do
  gem 'rspec', '2.0.1' 
  gem 'webrat', '0.7.1'
end

Then I do a:

bundle install

But terminal gives me this:

Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.5.0) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.2) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.26) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.16) 
Using actionmailer (3.0.3) 
Using arel (2.0.9) 
Using activerecord (3.0.3) 
Using activeresource (3.0.3) 
Using bundler (1.0.12) 
Using diff-lcs (1.1.2) 
Installing nokogiri (1.4.4) /Library/Ruby/Site/1.8/rubygems/installer.rb:574:in `initialize': Permission denied - /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.4/.autotest (Errno::EACCES)
from /Library/Ruby/Site/1.8/rubygems/installer.rb:574:in `open'

I've done a bunch of research on this and I've found some people who had the same problems: http://taleswithrails.com/2011/01/error-gemfile-could-not-find-gem-webrat/

开发者_Python百科And I've read the installation guide: http://nokogiri.org/tutorials/installing_nokogiri.html

But I can't get:

sudo port ...

or

sudo apt-get ...

To work. They return with "command not found". So I think I have two issues here...

1) Nokogiri is not installing properly and I'm not sure why. I also don't know what "flavor" of machine I'm running (in other words, which of the Nokogiri installation instructions pertains to my setup).

2) Those commands don't work on my system (OSX 10.6) and I'm not sure why. I've read up on Macports and libxml2 but it's a little unclear to me what it is and what I need to do (or if it's even applicable to me). I did try installing macports, but I don't have Xcode, which is required. But I'm not a "mac developer". Is this my only option?


So it seems like you have several different problems going on at the same time and you need to sort them out one by one.

First, can you run gem install Nokogiri in your terminal, and then try using it in IRB to check that it works?

Then, you should that sudo apt-get is the command for getting software using aptitude which you will NOT be using on your mac, it is used for Linux. and sudo port uses macports to install nokogiri, which will only work if you have Macports installed.

I would recommend getting Homebrew and using brew install nokogiri

once you have it working locally in a ruby script, then worry about rails.

The permission denied error is probably because you have been using some sudo's where you should not be, on a mac you really should never be using that command. If you need to install ruby gems, look into RVM which will let you install 'most' gems without needing to sudo

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜