使用RVM在OSX上安装Rails 3

时间:2021-02-27 07:15:53

Trying to install the new Rails 3 release on OSX 10.6.

尝试在OSX 10.6上安装新的Rails 3版本。

Have never touched Ruby or Rails on this machine since purchased.

自购买以来从未在这台机器上碰过Ruby或Rails。

I was able to get rvm and get Ruby 1.9.2. installed. From there, I am stuck.

我可以得到rvm并得到Ruby 1.9.2。安装。从那里,我被困住了。

I tried:

我试着:

rvmsudo gem install rails -v 3.0.0
sudo gem install rails --pre
sudo gem install rails
sudo gem update rails

And I get the same result error each time:

每次都得到相同的结果错误

ERROR:  While executing gem ... (Errno::ENOENT)
    No such file or directory - /Users/kevin/.rvm/gems/ruby-1.9.2-head@rails3/cache/activesupport-3.0.0.gem

If I do gem list, it says LOCAL GEMS and doesn't list anything.

如果我做宝石列表,上面写的是本地宝石,没有列出任何东西。

I have read a few walkthroughs but honestly none of them address this issue and its kind of pissing me off. Why is this so difficult to install? Would love to learn it if someone could help me get it running.

我读过一些演练,但老实说,没有一个能解决这个问题,这让我很生气。为什么安装起来这么难?如果有人能帮我跑步,我很乐意去学。

I was trying to follow this:

我试着去做

http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm

http://eddorre.com/posts/installing-rails-3-beta-4-using-rvm

and this:

这:

http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard

http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard

Which is actually linked from the ROR guides website. Am I missing dependencies? How do I get them in?

这实际上是从ROR指南网站链接过来的。我缺失的依赖吗?我怎么让他们进来?

If I do rails -v I get:

如果我做rails -v,我得到:

rails -v
/Library/Ruby/Site/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
    from /Library/Ruby/Site/1.8/rubygems.rb:214:in `activate'
    from /Library/Ruby/Site/1.8/rubygems.rb:1082:in `gem'
    from /usr/bin/rails:18

9 个解决方案

#1


27  

Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.

旧版本的rvm有一个bug,它可能导致ruby版本交叉连接,因为操作系统可以缓存哪个命令的可执行路径(特别是如果您使用zsh)。看看耶胡达·卡茨对这一主题的长篇、详细、发人深省的文章。

What I had to do this morning:

我今天早上要做的是:

rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby          # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r             # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails         # check to be sure we are using rvm version of rails

Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update

注意:在更新的rvm版本中,必须使用rvm get stable而不是rvm update

#2


2  

You don't need to use sudo when installing gems with rvm. If you follow the directions here to get RVM installed, you should be able to just do rvm use 1.9.2; gem install rails --version 3.0.0.

在使用rvm安装gems时,不需要使用sudo。如果您按照这里的说明安装RVM,您应该能够使用1.9.2进行RVM安装;gem安装rails——3.0.0版本。

#3


2  

You don't have to specify version 3. If you have 1.9.2-p0, it will automatically get rails 3 when you rvm gem install rails 3. note: no sudo. I think when you use sudo it makes it use the system-installed ruby. If you think you need sudo, use rvmsudo.

您不必指定版本3。如果您有1.2 .2-p0,那么在rvm gem安装rails 3时,它将自动获得rails 3。注意:没有sudo。我认为当你使用sudo时它会使用系统安装的ruby。如果您认为需要sudo,请使用rvmsudo。

Things probably got messy because you were following guides based on the pre-stable release of rails, which involved many other things. If you like, you can try uninstalling rvm and re-doing everything. It really isn't all that difficult.

事情可能会变得一团糟,因为您正在遵循基于rails前稳定版本的指南,其中包含了许多其他内容。如果您愿意,可以尝试卸载rvm并重新执行所有操作。这真的不那么难。

Remember, you need 1.9.2, 1.9.1 won't work.

记住,你需要1.9.2 1.9.1不能工作。

curl -O http://rvm.beginrescueend.com/releases/rvm-install-head
sh rvm-install-head
rvm install 1.9.2-p0

# also remember to edit your bash profile and add the required lines

# verify that 1.9.2-p0 shows up there
rvm list

# makes it so you're using it, and sets it as the default
rvm use 1.9.2-p0 --default

# verify this happened. should have => 1.9.2-p0 in the list
rvm list

# verify the version
ruby --version

# should automatically get 3.0
# `rvm gem install` installs it for every single installed ruby version
# in my experience
gem install rails

When you did rvm gem install, I think it installs it for every ruby version you have registered with rvm (at least it happened in my experience), so my assumption is that it was trying to force install rails 3 for an older ruby installation, which was missing the required gems.

当你rvm gem安装,我想它安装每个ruby版本你有注册区(至少它发生在我的经验),所以我的假设是,它试图强迫安装rails 3旧ruby安装,这是缺少所需的宝石。

Take it easy, not many commands are required. If you find yourself having to do 'hacks' or workarounds, then you're doing it wrong. Thankfully it's easy to start over. To remove rvm, just do rm -rfv ~/.rvm and also rm ~/.rvmrc if it's there.

放松点,不需要很多命令。如果你发现自己不得不做“黑客”或变通方法,那你就错了。谢天谢地,重新开始很容易。要删除rvm,只需执行rm -rfv ~/。rvm和rm ~/。rvmrc如果它的存在。

Let me know how it goes.

告诉我怎么回事。

#4


2  

working through this myself as new user mac osx blah blah

通过这个我自己做新的用户mac osx等等。

seems like a cache directory doesn't get made, try mkdir $HOME/.rvm/gems/cache

好像一个缓存目录没有被创建,尝试mkdir $HOME/.rvm/gems/缓存。

so far so good after that...

到目前为止一切都很好。

#5


1  

I am running into the same problem (tried uninstalling and installing like Blaenk suggested)

我遇到了同样的问题(尝试卸载和安装,就像Blaenk建议的那样)

rvm -v rvm 1.0.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescue eend.com/]

ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

ruby -v ruby 1.9.2p0(2010-08-18修订版29036)[x86_64-达尔文10.4.0]

gem install rails ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem

gem安装rails错误:在执行gem时…(Errno: ENOENT)没有这样的文件或目录—/Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0. gem

#6


1  

After doing "rvm update && rvm reload" rvm got updated to 1.04 (instead of 1.02 which I got via the recommended GIT install yesterday!?) it worked nicely.

在做了“rvm更新和rvm重新加载”之后,rvm被更新到1.04(而不是我昨天通过推荐的GIT安装得到的1.02 !?)

#7


1  

The solution worked for me, with a few tweeks:

这个办法对我起了作用,只花了几个星期:

Instead of using rvm update, I had to use rvm rubygems. Then, after doing all the work from post 2, I had to execute bundle install and I entered rvm use 1.9.2@rails3 to my .rvmrc file. Everything now works like a charm, even when starting a new shell or terminal session. The full list of commands I used is:

我不使用rvm更新,而是使用rvm rubygems。然后,在完成了post 2的所有工作之后,我必须执行bundle安装,并将rvm使用1.9.2@rails3输入到我的.rvmrc文件。现在,即使是在启动新的shell或终端会话时,一切都像魔法一样发挥作用。我使用的命令的完整列表是:

>> NEW >> rvm rubygems
rvm reload                 # update rvm
rvm gemset delete rails3   # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby                 # check to be sure the ruby interpretter is properly set to 1.9.2
>> DID NOT NEED >> hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails                # check to be sure we are using rvm version of rails
>> NEW >> bundle install
>> NEW >> cat 'rvm use 1.9.2@rails3' > .rvmrc

#8


0  

Followed these instructions, and found them very useful for rvm installation. Hope they work for you.

遵循这些说明,发现它们对于rvm安装非常有用。希望他们能为你工作。

http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/

http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/

#9


0  

Doing this after the rvm update and reload worked for me:

在rvm更新和重新加载之后做这个对我来说是有用的:

rm -rf .bundle && bundle install

#1


27  

Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.

旧版本的rvm有一个bug,它可能导致ruby版本交叉连接,因为操作系统可以缓存哪个命令的可执行路径(特别是如果您使用zsh)。看看耶胡达·卡茨对这一主题的长篇、详细、发人深省的文章。

What I had to do this morning:

我今天早上要做的是:

rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby          # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r             # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails         # check to be sure we are using rvm version of rails

Note: On newer versions of rvm, you will have to use rvm get stable instead of rvm update

注意:在更新的rvm版本中,必须使用rvm get stable而不是rvm update

#2


2  

You don't need to use sudo when installing gems with rvm. If you follow the directions here to get RVM installed, you should be able to just do rvm use 1.9.2; gem install rails --version 3.0.0.

在使用rvm安装gems时,不需要使用sudo。如果您按照这里的说明安装RVM,您应该能够使用1.9.2进行RVM安装;gem安装rails——3.0.0版本。

#3


2  

You don't have to specify version 3. If you have 1.9.2-p0, it will automatically get rails 3 when you rvm gem install rails 3. note: no sudo. I think when you use sudo it makes it use the system-installed ruby. If you think you need sudo, use rvmsudo.

您不必指定版本3。如果您有1.2 .2-p0,那么在rvm gem安装rails 3时,它将自动获得rails 3。注意:没有sudo。我认为当你使用sudo时它会使用系统安装的ruby。如果您认为需要sudo,请使用rvmsudo。

Things probably got messy because you were following guides based on the pre-stable release of rails, which involved many other things. If you like, you can try uninstalling rvm and re-doing everything. It really isn't all that difficult.

事情可能会变得一团糟,因为您正在遵循基于rails前稳定版本的指南,其中包含了许多其他内容。如果您愿意,可以尝试卸载rvm并重新执行所有操作。这真的不那么难。

Remember, you need 1.9.2, 1.9.1 won't work.

记住,你需要1.9.2 1.9.1不能工作。

curl -O http://rvm.beginrescueend.com/releases/rvm-install-head
sh rvm-install-head
rvm install 1.9.2-p0

# also remember to edit your bash profile and add the required lines

# verify that 1.9.2-p0 shows up there
rvm list

# makes it so you're using it, and sets it as the default
rvm use 1.9.2-p0 --default

# verify this happened. should have => 1.9.2-p0 in the list
rvm list

# verify the version
ruby --version

# should automatically get 3.0
# `rvm gem install` installs it for every single installed ruby version
# in my experience
gem install rails

When you did rvm gem install, I think it installs it for every ruby version you have registered with rvm (at least it happened in my experience), so my assumption is that it was trying to force install rails 3 for an older ruby installation, which was missing the required gems.

当你rvm gem安装,我想它安装每个ruby版本你有注册区(至少它发生在我的经验),所以我的假设是,它试图强迫安装rails 3旧ruby安装,这是缺少所需的宝石。

Take it easy, not many commands are required. If you find yourself having to do 'hacks' or workarounds, then you're doing it wrong. Thankfully it's easy to start over. To remove rvm, just do rm -rfv ~/.rvm and also rm ~/.rvmrc if it's there.

放松点,不需要很多命令。如果你发现自己不得不做“黑客”或变通方法,那你就错了。谢天谢地,重新开始很容易。要删除rvm,只需执行rm -rfv ~/。rvm和rm ~/。rvmrc如果它的存在。

Let me know how it goes.

告诉我怎么回事。

#4


2  

working through this myself as new user mac osx blah blah

通过这个我自己做新的用户mac osx等等。

seems like a cache directory doesn't get made, try mkdir $HOME/.rvm/gems/cache

好像一个缓存目录没有被创建,尝试mkdir $HOME/.rvm/gems/缓存。

so far so good after that...

到目前为止一切都很好。

#5


1  

I am running into the same problem (tried uninstalling and installing like Blaenk suggested)

我遇到了同样的问题(尝试卸载和安装,就像Blaenk建议的那样)

rvm -v rvm 1.0.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescue eend.com/]

ruby -v ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

ruby -v ruby 1.9.2p0(2010-08-18修订版29036)[x86_64-达尔文10.4.0]

gem install rails ERROR: While executing gem ... (Errno::ENOENT) No such file or directory - /Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0.0.gem

gem安装rails错误:在执行gem时…(Errno: ENOENT)没有这样的文件或目录—/Users/pragnesh/.rvm/gems/ruby-1.9.2-p0/cache/activesupport-3.0. gem

#6


1  

After doing "rvm update && rvm reload" rvm got updated to 1.04 (instead of 1.02 which I got via the recommended GIT install yesterday!?) it worked nicely.

在做了“rvm更新和rvm重新加载”之后,rvm被更新到1.04(而不是我昨天通过推荐的GIT安装得到的1.02 !?)

#7


1  

The solution worked for me, with a few tweeks:

这个办法对我起了作用,只花了几个星期:

Instead of using rvm update, I had to use rvm rubygems. Then, after doing all the work from post 2, I had to execute bundle install and I entered rvm use 1.9.2@rails3 to my .rvmrc file. Everything now works like a charm, even when starting a new shell or terminal session. The full list of commands I used is:

我不使用rvm更新,而是使用rvm rubygems。然后,在完成了post 2的所有工作之后,我必须执行bundle安装,并将rvm使用1.9.2@rails3输入到我的.rvmrc文件。现在,即使是在启动新的shell或终端会话时,一切都像魔法一样发挥作用。我使用的命令的完整列表是:

>> NEW >> rvm rubygems
rvm reload                 # update rvm
rvm gemset delete rails3   # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2@rails3
which ruby                 # check to be sure the ruby interpretter is properly set to 1.9.2
>> DID NOT NEED >> hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails                # check to be sure we are using rvm version of rails
>> NEW >> bundle install
>> NEW >> cat 'rvm use 1.9.2@rails3' > .rvmrc

#8


0  

Followed these instructions, and found them very useful for rvm installation. Hope they work for you.

遵循这些说明,发现它们对于rvm安装非常有用。希望他们能为你工作。

http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/

http://adventuresincoding.com/2010/01/taking-the-helm-of-ruby-with-ruby-version-manager/

#9


0  

Doing this after the rvm update and reload worked for me:

在rvm更新和重新加载之后做这个对我来说是有用的:

rm -rf .bundle && bundle install