本文共 4646 字,大约阅读时间需要 15 分钟。
ruby setup.rb
/usr/local/lib/ruby
), then they have the option of installing RubyGems in a alternate location. /home/mystuff
) with a repository named /home/mygemrepository
): $ export GEM_HOME=/home/mygemrepository $ ruby setup.rb config --prefix=/home/mystuff $ ruby setup.rb setup $ ruby setup.rb installNotes:
export
command is ksh
specific. Use the appropriate command for your OS. For example windows users would probably say:set GEM_HOME=/home/mygemrepository
/home/mystuff/bin
to your path so that the gem
command can be found.GEM_HOME
setup to your profile, so that RubyGems can find the location of your gem repository.GEM_HOME
prefix_dir/gems
. (where prefix_dir is given as the valud of --prefix
in the config step)gem update --system
gem install rubygems-update update_rubygems
require 'rubygems' require 'some_gem_library' # ...
-rubygems
Command Line Optionruby
interpreter to preload ruby gems before running other software. You can easily do this by giving the ruby
command a -rubygems
option each time you run a program. ruby -rubygems my_program_that_uses_gems
RUBYOPT
RUBYOPT
environment variable to the value rubygems
, you tell Ruby to load RubyGems every time it starts up. This is similar to the -rubygems
options above, but you only have to specify this once (rather than each time you run a Ruby script). .profile
(or equivalent): export RUBYOPT=rubygems