Gem bundle install 能在用户的 gem 目录中进行安装吗?

ekim_sgra · 2012年04月24日 · 最后由 ekim_sgra 回复于 2012年05月01日 · 15464 次阅读

如果用普通用户执行 gem install 会在~/.gem 目录下安装,但是 bundle install 的默认行为是在系统 gem 目录安装,貌似也没有相应的选项啊? --path 选项好像不对。

bundle package 会把 gem 文件缓存到 vendor/cache 下;

在 gem install vendor/cache/* --local 安装就可以了。

还是会提示输入密码啊,而且这个会把所有依赖的 gem 都下到 cache 下吧,我想要的是把 Gemfile 中没有的 gem 安装到 ome 下面的 gem 目录下。

Make sure all dependencies in your Gemfile are available to your application.

$ bundle install [--system]

Gems will be installed to your default system location for gems. If your system gems are stored in a root-owned location (such as in Mac OSX), bundle will ask for your root password to install them there.

While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile.

The --system option is the default. Pass it to switch back after using the --path option as described below.

Install your dependencies, even gems that are already installed to your system gems, to a location other than your system's gem repository. In this case, install them to vendor/bundle.

$ bundle install --path vendor/bundle

http://gembundler.com/bundle_install.html

解决了,把 BUNDLE_PATH 设为~/.gem/ruby/1.9.1 就会在本地 gem 目录安装。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号