如果你是为了装rails用的话,
会有点复杂。
可先做个试验看看:
[username
@ithelp ~]$ mkdir Zoo
[username@ithelp ~]$ echo 2.2.2 >> Zoo/.ruby-version
[username@ithelp ~]$ echo myset >> Zoo/.ruby-gemset
[username@ithelp ~]$ cd Zoo
[username@ithelp ~]$ cd Zoo
ruby-2.2.2 - #gemset created /home/username/.rvm/gems/ruby-2.2.2@myset
ruby-2.2.2 - #generating myset wrappers..........
$ rvm list
rvm rubies
ruby-2.0.0-p0 [ x86_64 ]
ruby-2.0.0-p195 [ x86_64 ]
ruby-2.0.0-p247 [ x86_64 ]
ruby-2.1.0 [ x86_64 ]
ruby-2.1.1 [ x86_64 ]
ruby-2.1.2 [ x86_64 ]
ruby-2.1.4 [ x86_64 ]
ruby-2.1.5 [ x86_64 ]
ruby-2.2.0 [ x86_64 ]
* ruby-2.2.1 [ x86_64 ]
=> ruby-2.2.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
[username@ithelp Zoo]$ rvm gemset list
gemsets for ruby-2.2.2 (found in /home/username/.rvm/gems/ruby-2.2.2)
(default)
em
global
=> myset
[username@ithelp Zoo]$ bundle init
Writing new Gemfile to /home/username/Zoo/Gemfile
[username@ithelp Zoo]$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
bundler (1.10.2)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.1)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
[username@ithelp Zoo]$ vi Gemfile
# A sample Gemfile
source "
https://rubygems.org"
gem "mysql2"
[username@ithelp Zoo]$ bundle
Fetching gem metadata from
https://rubygems.org/..Fetching version metadata from
https://rubygems.org/.Resolving dependencies...
with native extensions Installing mysql2 0.3.19
Using bundler 1.10.2
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
[username@ithelp Zoo]$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.6)
bundler (1.10.2)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.1)
mysql2 (0.3.19)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)