宝石环境/安装位置和捆绑器

时间:2013-10-01 20:19:37

标签: ruby-on-rails gem bundle

自从我设置一个全新的Rails环境以来已经有一段时间了。

我试图让宝石安装在〜/ .gems下,而不是/ usr,以避免不断冒充。

这是我的宝石环境:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.3
  - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/myname/.gems
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /home/myname/.gems/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/myname/.gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-rdoc --no-ri"
     - "gemhome" => "/home/myname/.gems"
     - "gempath" => ["/home/myname/.gems"]
  - REMOTE SOURCES:
     - https://rubygems.org/

$ which bundle
/home/myname/.gems/bin/bundle

现在我做了rails new SomeApp,当我跑步时 捆绑安装

我明白了:

Errno::EACCES: Permission denied - /usr/local/lib/ruby/gems/2.0.0/build_info/jquery-rails-3.0.4.info
An error occurred while installing jquery-rails (3.0.4), and Bundler cannot continue

这告诉我它仍在尝试将gem安装在我想要的地方。有什么想法要检查? (我有一个〜/ .gemrc文件,内容是上面GEM CONFIGURATION部分的最后3行。)

非常感谢所有提示 - 这应该是一个快速而简单的步骤:)

1 个答案:

答案 0 :(得分:0)

强烈推荐rbenv和rbenv-gemset,在这里安装自制软件:

brew install rbenv rbenv-gemset
cd into/project/
echo specialgemsetname > .rbenv-gemsets

现在启动一个新终端(以确保环境正确)并设置您的项目。