Ruby Bundler权限问题

时间:2010-08-25 15:13:18

标签: ruby permissions rubygems bundler

所以,我很肯定我曾经绝望地做过sudo bundle install,我现在明白这是一个禁忌。但现在,当我尝试运行bundle install时,我收到以下错误:

Installing culerity (0.2.12) /Library/Ruby/Site/1.8/rubygems/installer.rb:294:in `generate_bin': You don't have write permissions into the /Library/Ruby/Gems/1.8/bin directory. (Gem::FilePermissionError)
    from /Library/Ruby/Site/1.8/rubygems/installer.rb:196:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/source.rb:100:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:55:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/spec_set.rb:12:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:44:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/installer.rb:8:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/cli.rb:217:in `install'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/task.rb:22:in `send'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/task.rb:22:in `run'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor.rb:246:in `dispatch'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/lib/bundler/vendor/thor/base.rb:389:in `start'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.0.rc.6/bin/bundle:13
    from /usr/bin/bundle:19:in `load'
    from /usr/bin/bundle:19

我已经尝试删除〜/ .bundle~ / .gem .bundle Gemfile.lock中的所有内容以及/ Library / Ruby(OSX 10.6)中对culerity或capybara的任何引用。我还检查了以确保在此项目中的所有文件上正确设置了权限(而不是root)。我也清除了宝石缓存。

我的Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.0.rc2'

# Bundle edge Rails instead:
#gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
gem 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri', '1.4.1'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for certain environments:
# gem 'rspec', :group => :test
# group :test do
#   gem 'webrat'
# end

gem 'haml', '3.0.15'
gem 'mogli', '0.0.13' #, :path => "~/Sites/mogli"
gem 'facebooker2', '0.0.4'
gem 'geokit'
gem 'acts_as_restful_list'
gem 'hoptoad_notifier'

group :development, :test do
  gem "rspec-rails", '2.0.0.beta.19'
  gem 'factory_girl_rails'
  gem 'capybara', '0.3.9'
  gem 'database_cleaner'
  gem 'cucumber-rails', '0.3.2'
  gem 'cucumber', '0.8.5'
  gem 'spork'
  gem 'launchy'    # So you can do Then show me the page
end

另外,我的系统上有rvm,但是我正在使用系统ruby来完成这个项目。

关于导致许可问题的任何想法?当然,我并没有使用sudo bundle install

感谢。

3 个答案:

答案 0 :(得分:3)

看起来你正在使用系统的红宝石。您有几个选择:

  • 使用sudo安装捆绑系统。这可能是来自不同应用程序的冲突宝石的问题。
  • 使用bundle install --path bundle_dir,它将在bundle_dir中安装gems
  • 使用rvm(http://rvm.beginrescueend.com),这个程序将允许您使用不同的ruby版本和不同的宝石集。

答案 1 :(得分:0)

尝试触摸特定路径中的文件。我猜OS X正在保护这些目录不仅仅是正常方式吗?我认为OS X支持其文件系统的ACL,也许你必须在那里看看?

答案 2 :(得分:-3)

也许尝试在所有内容上使用chmod,但看起来你需要将它作为sudo运行...不确定为什么那不是一个选项......