How to install multiple ruby gems at once?

2019-04-06 16:36发布

Is is possible to install more than one gem at the same time with only one command?

3条回答
Rolldiameter
2楼-- · 2019-04-06 16:51

You can using bundler: http://gembundler.com/

查看更多
时光不老,我们不散
3楼-- · 2019-04-06 16:58

You can put them in a Gemfile and use bundler (bundle install).

Alternatively, you could list the commands in a file:

gem install pg
gem install sqlite3

and use something like cat <filename> | xargs sudo to execute them.

**Consider using RVM to manage your gems into gemsets rather than installing them globally with sudo.

查看更多
4楼-- · 2019-04-06 17:09

The gem install command accepts many parameters, so you can gem install nokogiri bundler in one shot, for instance.

As others said, Bundler and RVM makes everything connected to managing gems, versions and dependencies a real pleasure.

查看更多
登录 后发表回答