2013-03-19 38 views
6

我覺得自己是個白癡,但是我一直在這一整天都在忙着取得任何地方。OSX上的Rubygems不存在

我已經重新啓動了幾次,試圖在我的OSX環境,RVM,Brew,Ruby上完全安裝Ruby:並且每次通過Ruby安裝它都會在rubygems安裝中達到最低限度。

我不得不重新開始的原因是,在我第一次成功安裝之後,RVM不會在Jewelbox中更新(使用打包的一體化RubyInstaller),所以我無法管理我的寶石 - 一個問題由系統上的初始Ruby安裝生成在/ usr/local中而不是在我自己的目錄下。爲了解決這個問題,我卸載了所有的Ruby工具,然後重新開始。

一切正常,直到ruby編譯器在安裝ruby 2.0.0時開始在rubygems安裝部分開始大吃一驚。檢查usr/bin下的OSX系統文件我發現rubygems也不存在(它應該在OSX上默認存在)。有任何想法嗎? (請注意,Xcode是最新的,並且具有命令行工具安裝)

最新的嘗試是:

$ rvm get head --autolibs=3 # get the latest RVM and build required libs 
$ rvm requirements # just in case, install all other required stuff 
$ rvm remove 2.0.0 
$ rvm install ruby-2.0.0 

。 。 。這觸發以下錯誤:

[2013-03-19 23:21:50] /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/ruby 
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1073 - cannot load such file -- rubygems/defaults/operating_system 
Exception `LoadError' at /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems.rb:1082 - cannot load such file -- rubygems/defaults/ruby 
mkdir -p /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/site_ruby/2.0.0 

...

install -c -m 0755 /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634 /Users/matthew.evans/.rvm/rubies/ruby-2.0.0-p0/bin/gem 
rm /var/folders/nq/wkj89k854tl0w97n68qdn820pzk_51/T/gem.84634 
ERROR: While executing gem ... (NoMethodError) 
    undefined method `fu_stream_blksize' for #<Gem::Commands::SetupCommand:0x007ffd0e054818> 
Installing RubyGems 
Installing gem executable 
+0

嘗試以下操作:'回聲$ {LANG:-empty}'然後 '出口LANG =的en_US.UTF-8'。之後,再試一次。 – fmendez 2013-03-19 22:56:39

+0

@fmendez:爲什麼? – AGS 2013-03-19 23:15:28

+0

@AGS由於類似的問題在這裏報道:https://github.com/wayneeseguin/rvm/issues/1689和鏡像在這裏:https://github.com/rubygems/rubygems/issues/516 – fmendez 2013-03-19 23:20:21

回答

1

我相信這個問題就是RVM放置你的依賴 - 全球VS用戶文件夾。從所謂的 「敏捷開發使用Rails」 的書:

First, you’ll need to make sure you have Xcode 3 or later installed...

$ xcodebuild -version 

If you have Xcode version 3 installed, you’ll need to install the Git version control system separately. Verify your installation by running the following command:

$ git --version 

Next, install RVM itself:

$ curl -L https://get.rvm.io | bash -s stable 

Exit your command window or Terminal application and open a new one. This causes your .bash_login to be reloaded. Execute the following command, which provides additional installation instructions tailored to your specific operating system:

$ rvm requirements 

Look for the line that tells you how to install the necessary OS dependencies for Ruby (MRI). Once you complete those instructions, you can proceed to install the Ruby interpreter itself:

$ rvm install 2.0.0 

The preceding step will take a while as it downloads, configures, and compiles the necessary executables. Once it completes, use that environment, and install rails:

$ rvm use 2.0.0 
$ gem install rails --version 4.0.0.beta1 --no-ri --no-rdoc 

With the exception of the rvm use statement, each of the above instructions need only be done once. The rvm use statement needs to be repeated each time you open a shell window. The use keyword is optional, so you can abbreviate this to rvm 2.0.0. You can also choose to make it the default Ruby interpreter for new terminal sessions with the following command:

$ rvm --default 2.0.0 

You can verify successful installation using the following command:

$ rails -v 

如果你遇到麻煩,試試下的故障排除安裝在RVM網站標題所列的建議。

希望能爲您做到!

+4

我確實發現我錯過了一些rvm要求。一旦排序,'rvm install 2.0.0'確實會返回類似的錯誤。但之後運行'rvm ruby​​gems latest'將成功安裝rubygems。 – lulalala 2013-03-21 03:17:59

3

我在今天在rvm中安裝ruby v2時發生了完全相同的錯誤。我在Ubuntu的用戶帳戶中需要使用'sudo',並輸入我的sudo賬戶密碼才能安裝操作系統依賴項。

您的問題提到運行rvm requirements安裝依賴關係。從v1.19開始,這似乎是rvm中的新行爲。它似乎安裝了一堆依賴關係。但隨後安裝紅寶石轟炸。

在早期版本的RVM,打字rvm requirements只想列表依賴於RVM和紅寶石,在Archonic's答案。

我輸入rvm implode,然後開始了與:

\curl -L https://get.rvm.io | bash -s 1.18.21 
source /home/deploy/.rvm/scripts/rvm 
rvm requirements 

在這一點上我可以安裝庫/那RVM說我需要爲RVM和紅寶石,然後rvm install ruby-2.0.0-p0工具成功。

+1

作爲參考,在rvm 1.19.0中'rvm requirements'錯過的「NEW」庫是: build-essential dpkg-dev g ++ g ++ - 4.6 libapr1 libaprutil1 libdb4.8 libdpkg-perl libneon27-gnutls libstdC++ 6- 4.6-dev libsvn1 subversion – 2013-03-27 15:05:21

1

這爲我工作:

rvm get head 
rvm requirements 
rvm install ruby-2.0