RubyGems

Package manager for Ruby

gem -h/--help
gem -v/--version
gem command [arguments …] [options …]

Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install

Further gem help:

commands list all 'gem' commands
examples show some examples of usage
gem_dependencies gem dependencies file guide
platforms gem platforms guide
<COMMAND> show help on COMMAND (e.g. 'gem help install')
gem server present a web page at http://localhost:8808/ with info about installed gems

gem install gemname [gemname] [options] -- --build-flags [options]

--platform platform to install
-v
--version version
of gem to install
--[no-]prerelease Allow prerelease versions of a gem to be installed. (Only for listed gems)
Install/Update Options
-i
--install-dir dir
repository directory to get installed gems
-n
--bindir dir
where binary files are located --[no-]document [TYPES] Generate documentation for installed gems List the documentation types you wish to generate. For example: rdoc,ri
--build-root dir Temporary installation root. Useful for building packages. Do not use this when installing remote gems.
--vendor Install gem into the vendor directory. Only for use by gem repackagers.
-N
--no-document
Disable documentation generation
-E
--[no-]env-shebang
Rewrite the shebang #! line on installed scripts to use /usr/bin/env
-f
--[no-]force
Force gem to install, bypassing dependency checks
-w
--[no-]wrappers
Use bin wrappers for executables Not available on dosish platforms
-P
--trust-policy POLICY
Specify gem trust policy
--ignore-dependencies Do not install any required dependent gems
--[no-]format-executable Make installed executable names match ruby. If ruby is ruby18, foo_exec will be foo_exec18
--[no-]user-install Install in user's home directory instead of $GEM_HOME.
--development Install additional development dependencies
--development-all Install development dependencies for all gems (including dev deps themselves)
--conservative Don't attempt to upgrade gems already meeting version requirement
--minimal-deps Don't upgrade any dependencies that already meet version requirements
--[no-]post-install-message Print post install message
-g
--file [FILE]
Read from a gem dependencies API file and install the listed gems
--without groups Omit the groups (comma separated) when installing from a dependencies file
--default Add full specification to specifications/default and extract only its bin
--explain indicate which would be installed
--[no-]lock Create a lock file (when used with -g/--file)
--[no-]suggestions Suggest alternates when gems are not found
Local/Remote Options:
-l
--local
Restrict operations to the LOCAL domain
-r
--remote
Restrict operations to the REMOTE domain
-b
--both
Allow LOCAL and REMOTE operations
-B
--bulk-threshold count
Threshold for switching to bulk synchronization (default 1000)
--clear-sources Clear the gem sources
-s
--source URL
Append URL to list of remote gem sources
-p
--[no-]http-proxy [URL]
Use HTTP proxy for remote operations
Common Options:
-h
--help
Get help on this command
-V
--[no-]verbose
Set the verbose level of output
-q
--quiet
Silence commands
--config-file FILE Use this config file instead of default
--backtrace Show stack backtrace on errors
--debug Turn on Ruby debugging
--norc Avoid loading any .gemrc file
Deprecated Options
--[no-]rdoc Generate RDoc for installed gems Use --document instead
--[no-]ri Generate ri data for installed gems. Use --document instead
-u
--[no-]update-sources
Update local source cache
Arguments: GEMNAME name of gem to install

: Install a gem into the local repository

For gems with executables ruby installs a wrapper file into the executable directory by default. This can be overridden with the --no-wrappers option. The wrapper allows you to choose among alternate gem versions using _version_.

For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer version is also installed.

Gem Dependency Files

RubyGems can install a consistent set of gems across multiple environments using `gem install -g` when a gem dependencies file (gem.deps.rb, Gemfile or Isolate) is present. If no explicit file is given RubyGems attempts to find one in the current directory.

When the RUBYGEMS_GEMDEPS environment variable is set to a gem dependencies file the gems from that file will be activated at startup time. Set it to a specific filename or to "-" to have RubyGems automatically discover the gem dependencies file by walking up from the current directory.

Enabling automatic discovery on multiuser systems can lead to execution of arbitrary code when used from directories outside your control.

Extension Install Failures

If an extension fails to compile during gem installation the gem specification is not written out, but the gem remains unpacked in the repository. You may need to specify the path to the library's headers and libraries to continue. You can do this by adding a -- between RubyGems' options and the extension's build options:
      $ gem install some_extension_gem
      [build fails]
      Gem files will remain installed in \
      /path/to/gems/some_extension_gem-1.0 for inspection.
      Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
      $ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
      [build succeeds]
      $ gem list some_extension_gem
    
      *** LOCAL GEMS ***
    
      some_extension_gem (1.0)

If you correct the compilation errors by editing the gem files write the specification by hand. For example:
 $ gem install some_extension_gem
      [build fails]
      Gem files will remain installed in \
      /path/to/gems/some_extension_gem-1.0 for inspection.
      Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
      $ [cd /path/to/gems/some_extension_gem-1.0]
      $ [edit files or what-have-you and run make]
      $ gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \
                 ../../specifications/some_extension_gem-1.0.gemspec
      $ gem list some_extension_gem
    
      *** LOCAL GEMS ***
    
      some_extension_gem (1.0)

Defaults:

--both --version '>= 0' --document --no-force --install-dir /home/realger1/ruby/gems --lock

guides.rubygems.org