2010-10-26 41 views
1
bogon:~ Zhulin$ ruby -v 
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0] 
bogon:~ Zhulin$ rails -v 
Rails 1.2.6 
bogon:~ Zhulin$ gems -v 
-bash: gems: command not found 
bogon:~ Zhulin$ sudo gem install heroku 
Password: 
ERROR: While executing gem ... (Gem::RemoteSourceException) 
    HTTP Response 302 fetching http://gems.rubyforge.org/yaml 
bogon:~ Zhulin$ gem -v 
1.0.1 
bogon:~ Zhulin$ gem list 

*** LOCAL GEMS *** 

actionmailer (1.3.6) 
actionpack (1.13.6) 
actionwebservice (1.2.6) 
activerecord (1.15.6) 
activesupport (1.4.4) 
acts_as_ferret (0.4.1) 
capistrano (2.0.0) 
cgi_multipart_eof_fix (2.5.0) 
daemons (1.0.9) 
dnssd (0.6.0) 
fastthread (1.0.1) 
fcgi (0.8.7) 
ferret (0.11.4) 
gem_plugin (0.2.3) 
highline (1.2.9) 
hpricot (0.6) 
libxml-ruby (0.9.5, 0.3.8.4) 
mongrel (1.1.4) 
needle (1.3.0) 
net-sftp (1.1.0) 
net-ssh (1.1.2) 
rails (1.2.6) 
rake (0.7.3) 
RedCloth (3.0.4) 
ruby-openid (1.1.4) 
ruby-yadis (0.3.4) 
rubynode (0.1.3) 
sqlite3-ruby (1.2.1) 
termios (0.9.4) 
bogon:~ Zhulin$ gem -update 
ERROR: Invalid option: -update. See 'gem --help'. 
bogon:~ Zhulin$ gem update --system 
Updating RubyGems... 
ERROR: While executing gem ... (Gem::RemoteSourceException) 
    HTTP Response 302 fetching http://gems.rubyforge.org/yaml 
bogon:~ Zhulin$ gem install rubygems-update 
ERROR: While executing gem ... (Gem::RemoteSourceException) 
    HTTP Response 302 fetching http://gems.rubyforge.org/yaml 
bogon:~ Zhulin$ 

任何人都可以帮我弄明白吗?我无法在豹中安装任何宝石或更新

回答

2

如果您有Leopard,那么您可能会在Rails 2.3.10中使用Ruby 1.8.7。

更新你的Ruby,然后

gem update --system 

(或者你可能需要下载RubyGems的1.3.7从http://rubyforge.org/projects/rubygems/解压,并运行ruby setup.rb得到它)

之后,这些命令可以是

gem list 
gem list -r rails 
gem list -r rails$ 
gem list -rad rails$ <-- list all rails, with description, remotely 
gem install haml 
gem i fastercsv  <-- 'i' is a shorthand for install 

gem i rails --no-rdoc --no-ri <-- if you install a lot of gems by creating 
            different gemsets using RVM, and don't want 
            the docs every time 

sudo gem i sqlite3-ruby   <-- on some systems, the sudo is needed, but if 
            using RVM and you are not dealing with "system" 
            gems, the recommendation is don't use "sudo" 
4

我真的真的推荐使用RVM来安装新版本的Ruby。 RVM会将目标Ruby以及相关的gem放入主目录中的一个很好的沙箱中,而且不必担心Ruby的系统安装问题。如果您决定稍后删除它,则删除一个目录很简单。尝试使用修改后的系统安装,看看会发生什么。 :-)

与系统混淆有时是安全的,有时不好/危险/致命,取决于依赖于它。通过RVM路由,只有您编写的代码将依赖于沙箱中的Ruby。另外,你不需要以sudo的方式运行,所以你的安装不太容易出错。

RVM可在:rvm.beginrescueend.com。请务必按照installation page上的说明进行操作。

+0

谢谢,格雷格。我会在稍后尝试你的方法。 – mko 2010-10-29 08:45:27

+0

致命的事情开始在一个链接不存在了:) – 2013-04-19 21:10:53