刚升级到:
rails', '4.1.7
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
RVM 1.26.0
当我尝试
时$rails s
我收到此错误:
Could not find gem 'pg (~> 0.17.1) ruby' in the gems available on this machine.
这是我的Gemfile
gem 'rails', '4.1.7'
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg', '~> 0.17.1'
gem 'rails_12factor'
end
...
我试过了:
$ gem install pg
我得到了:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
更新1:
rmv list
rvm rubies
ruby-1.9.3-p327 [ x86_64 ]
ruby-1.9.3-p362 [ x86_64 ]
ruby-1.9.3-p550 [ x86_64 ]
ruby-2.0.0-rc1 [ x86_64 ]
* ruby-2.1.4 [ x86_64 ]
如果我做了红宝石,我会得到:
/usr/bin/ruby
这意味着我正在使用Ruby系统?或者RVM安装在系统文件夹下?
更新2:
我从System Ruby切换。我做了:
$ rvm使用默认
Using /Users/myname/.rvm/gems/ruby-2.1.4
$ ruby:
/Users/myname/.rvm/rubies/ruby-2.1.4/bin/ruby
$ ruby -v
ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin14.0]
现在,如果我这样做
$ rails -v
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 8 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
我很困惑。这是否意味着我需要重新安装rails ??