Fast ruby package management for unix
Shell C Ruby
Latest commit 9ac03fe Jan 2, 2012 @rtomayko Merge pull request #32 from richmeyers/package-install-empty-dirs
Fix rpg-package-install when gem contains empty dirs in lib.
Failed to load latest commit information.
doc tidy up rpg-solve(1) manpage Mar 22, 2010
misc add rpg-manifest to bash completion script Mar 22, 2010
.gitignore Added rpg-parse-gemfile command Sep 26, 2011
CHANGES 0.3.0 release Jun 24, 2010
COPYING add COPYING file Mar 12, 2010
HACKING misc HACKING file tweaks Apr 19, 2010
KNOWN-ISSUES add note to KNOWN-ISSUES about gem_stub as workaround for gem directives Apr 19, 2010
Makefile Added rpg-parse-gemfile command Sep 26, 2011
TODO Added a note and todo entry about file conflicts in packages Oct 17, 2011
configure Merge remote-tracking branch 'p/rpgdir' Jul 31, 2011
munge.rb Fix for issue #13 - propagate exit status when extension build fails Oct 12, 2011 rpg-package-list now known as rpg-package-index Mar 17, 2010 make gem fetch RPGGEMURL configurable Apr 27, 2010 rpg-diff shows diff between two package versions (WIP) Mar 22, 2010 rpg-env puts RPGLIB/RUBYARCH dirs on load path too Apr 25, 2010 make gem fetch RPGGEMURL configurable Apr 27, 2010 s/pgem/rpg/g on entire project Mar 14, 2010 rpg-help shows rpg --help output by default Mar 17, 2010 rpg-manifest lists files with abbreviated base paths unless -a given Apr 26, 2010 fix rpg-outdated not passing new -l flag to rpg-list Apr 19, 2010 Merge pull request #32 from richmeyers/package-install-empty-dirs Jan 2, 2012
rpg-parse-gemfile.rb Added rpg-parse-gemfile command Sep 26, 2011
rpg-parse-index.rb ignore prerelease versions in rpg-parse-index for now Mar 15, 2010 Display available package versions when installation fails. Aug 6, 2011 rpg-resolve writes versions only again, not package names Mar 22, 2010 Fixed a misspelling of heed in Aug 6, 2011 Merge pull request #28 from richmeyers/sass-version Oct 18, 2011
rpg-solve.c fix version compare with stuff like: 0.3.10 ~> Apr 26, 2010 Fixed a misspelling of RPGSTALETIME in Aug 6, 2011 rpg-uninstall doesn't die when unlink fails Apr 4, 2010 rpg-unpack -P extracts to RPGPACKS instead of RPGCACHE (oops) Apr 4, 2010 simplify rpg-upgrade; allow upgrading all packages with no args Mar 19, 2010 fix up main help screen for recent command name changes Mar 19, 2010
strnatcmp.h bring in strnatcmp lib for comparing versions Mar 21, 2010

rpg - manages gem packages. quickly.

This is rpg, an experimental Ruby package management utility for unix based on the Rubygems packaging format and repository protocol. rpg installs Ruby packages distributed from to a shared library directory with full support for dependency resolution, native extension compilation, and package upgrades. It's quite fast.

rpg can be thought of as a non-compatible alternative to the gem command shipped with Rubygems. Most commonly used gem operations are available in rpg, but in ways that are a bit different from the gem command -- both in interface and implementation. See the VERSUS RUBYGEMS section below for details on these differences.

rpg and Rubygems can co-exist on a system, though Rubygems is not required for rpg to operate. Packages installed with rpg override packages installed with the gem command.

Please direct rpg related discussion to the rpg mailing list:


Experimental. Using rpg with system rubys is not yet recommended. Suggested use is with rvm or custom, non-system ruby builds. See the KNOWN-ISSUES file for a list of potential gotchas and general annoyances.

IMPORTANT: In its default configuration, rpg installs library files under the active Ruby interpreter's vendor_ruby or site_ruby directory. The rpg config command outputs the current destination installation paths -- use it to verify the active configuration before performing destructive operations.


rpg is installed with the conventional ./configure && make && make install process. See the INSTALLING file for information on obtaining the latest release and variations on the basic installation.

See the HACKING file for information on setting up a temporary working environment for development, or if you just want to try out rpg in a sandbox before installing.

Basic Usage

For a list of commands and basic program usage:

$ rpg --help
Usage: rpg [-vx] [-c <path>] <command> [<args>...]
Manage gem packages, quickly.

The most commonly used rpg commands are:
  config           Show or edit rpg configuration
  dependencies     Show dependency information for a package or all packages
  install          Install a package from file or remote repository
  list             Show status of local packages vs. respository
  steal            Transplant packages from Rubygems into rpg environment
  sync             Sync the package index with repository
  outdated         List packages with a newer version
  uninstall        Uninstall packages from local system
  upgrade          Upgrade installed packages to latest version

  -c <path>        Read rcfile at <path> instead of standard rpgrc locations
  -v               Enable verbose logging to stderr
  -q               Disable verbose logging to stderr
  -x               Enable shell tracing to stderr (extremely verbose)

See `rpg help <command>' for more information on a specific command.

Installing one or more packages and all package dependencies:

$ rpg install rails
             sync: package index not found. retrieving now.
             sync: complete. 11894 packages available.
          prepare: calculating dependencies for rails ...
            fetch: rails 2.3.5
            fetch: activeresource 2.3.5
            fetch: actionmailer 2.3.5
            fetch: actionpack 2.3.5
            fetch: activesupport 2.3.5
            fetch: rake 0.8.7
            fetch: activerecord 2.3.5
            fetch: rack 1.0.1
          prepare: 0 of 8 packages already installed and up to date
          install: installing 8 packages
  package-install: actionmailer 2.3.5
  package-install: actionpack 2.3.5
  package-install: activerecord 2.3.5
  package-install: activeresource 2.3.5
  package-install: activesupport 2.3.5
  package-install: rack 1.0.1
  package-install: rails 2.3.5
  package-install: rake 0.8.7
          install: installation complete

Listing currently installed packages and their versions:

$ rpg list
actionmailer 2.3.5
actionpack 2.3.5
activerecord 2.3.5
activeresource 2.3.5
activesupport 2.3.5
rack 1.0.1
rails 2.3.5
rake 0.8.7

Listing currently installed packages with information about available package versions:

$ rpg list -l
  actionmailer                        2.3.5        2.3.5
  actionpack                          2.3.5        2.3.5
  activerecord                        2.3.5        2.3.5
  activeresource                      2.3.5        2.3.5
  activesupport                       2.3.5        2.3.5
* rack                                1.0.1        1.1.0
  rails                               2.3.5        2.3.5
  rake                                0.8.7        0.8.7

Listing only outdated packages:

$ rpg outdated
rack                                1.0.1        1.1.0

Uninstalling one or more packages:

$ rpg uninstall rails actionmailer

Listing package dependencies recursively:

$ rpg dependencies -r rails
actionmailer = 2.3.5
actionpack = 2.3.5
activerecord = 2.3.5
activeresource = 2.3.5
activesupport = 2.3.5
rack ~> 1.0.0
rake >= 0.8.3

Or, in a tree:

$ rpg dependencies -t rails
rake >= 0.8.3
activesupport = 2.3.5
activerecord = 2.3.5
|-- activesupport = 2.3.5
actionpack = 2.3.5
|-- activesupport = 2.3.5
|-- rack ~> 1.0.0
actionmailer = 2.3.5
|-- actionpack = 2.3.5
|   |-- activesupport = 2.3.5
|   |-- rack ~> 1.0.0
activeresource = 2.3.5
|-- activesupport = 2.3.5

To get a feel for rpg performance vs. the gem command when install packages with complex dependency graphs:

$ time rpg install merb
$ time gem install merb

Versus Rubygems

Similarities with the gem command:

  • rpg uses as its package repository and gem files as its package format. Installing from other sources is not yet supported, but is likely to be added in the near future.

  • rpg supports dependency resolution using the information included in a gem's specification metadata.

  • rpg supports building and installing native / dynamic library extensions.

  • rpg has a rich set of commands for installing, upgrading, and uninstalling packages; listing installed, available, and outdated packages; and utilities for unpacking gem files and inspecting gem specifications.

  • "rpg" is made of exactly three characters.

Differences from the gem command:

  • rpg organizes the files it installs by file type, not by package. For instance, Ruby library files are placed directly under a single lib directory (the currently active site_ruby directory by default), executables under /usr/local/bin (configurable), manpages under /usr/local/share/man, etc.

  • rpg is not capable of installing multiple versions of the same package into a single rpg environment -- the package's files would overwrite each other. All version conflicts must be resolved at install time.

  • rpg is similarly unable to install more than one package owning the same file under Ruby libdir. (Currently rpg will install such packages anyway, with later installed packages overwriting files installed by earlier installed packages.)

  • rpg has no runtime component (e.g., require 'rubygems'). Because all library files are placed under a common lib directory, and because package versions are sussed at install time, there's no need for a component to select which packages are active at runtime.

  • rpg installs packages in two stages: 1.) fetch package files and resolve dependencies, and 2.) install package contents. This allows for staged/later installs and conflict detection before install.

  • rpg's installed package database is filesystem based, (will be) documented, and is built for extension.

  • rpg is written primarily in POSIX shell and requires a unix environment.

  • rpg does not provide commands for building gems or running gem servers.

  • rpg outperforms the gem command in many ways. Most comparable operations complete in at least one order of magnitude less time.


rpg's design is inspired by a variety of existing tools. The gem command's basic UI, package format, and repository structure are heavily borrowed from or used verbatim.

Many of the ideas -- and maybe even some code -- were taken from Rip. That's understating it, really. rpg started out just a couple of loose shell scripts to experiment with ideas for integrating gem package and gem dependency support into rip. The plan was to port them over to Ruby and into Rip if they panned out. Within a few days, I had a more or less entire implementation of Rubygems's gem command in POSIX shell staring back at me and it was fast. Some of rpg's features may make their way into Rip (the Ruby portions that read release indexes and gemspecs should be useful at least).

Debian's apt and dpkg, FreeBSD's ports system, and Redhat/Fedora's yum all influenced rpg's design in various ways.

Git's overall design influenced rpg significantly. Git's internal project organization is a template for writing moderate sized systems using many small specialized programs. Its granular use of the filesystem as a database (the .git/refs and .git/objects hierarchies, especially) informed much of rpg's package database design.


Copyright (c) 2010 by Ryan Tomayko

This is Free Software distributed under the terms of the MIT license. See the COPYING file for license rights and limitations.