Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here is a summary of the versions below and how to get them:
Ruby 2.0.0 (Stable)
Summary: Ruby 2.0 is recommended for new projects.
To install Ruby 2.0, install.
Ruby 1.9.3 (Previous)
Summary: Use Ruby 1.9.3 for existing projects that depend on it.
To install Ruby 1.9, simply install. Ruby 1.9 includes RubyGems (detailed below).
- Vastly improved performance over 1.8
- New features for concurrency such as fibers.
- Various other language improvements, such as an improved CSV parser.
- Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)
- Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.
Ruby 1.8.7 (Deprecated)
Summary: Use Ruby 1.8.7 with any incompatible or out of date code as necessary.
Ruby 1.8.7 is the last stable version of the 1.8 series.
You can install AUR.AUR or AUR from the
RubyGems is not included with the AUR.AUR package, so install AUR from the
gem is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. The gem command will be installed if you followed the installation instructions above.
Running as normal user
When running gem as a user, the gems will be installed into
~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy with being installed in this way, and might insist on being installed by root (especially if they have native extensions). This is considered the best way to manage gems on Arch.
To use gems which install binaries, you need to add
~/.gem/ruby/2.0.0/bin to your
This per-user behavior is enabled via
/etc/gemrc and can be overridden by a
Running as root
When running as root, the gems will be installed into
/root/.gems and will not be installed to
Bundler solves these problems to some extent by packaging gems into your application. See the section below on using bundler.
$ gem update
Installing a gem
This example installs the MySQL ruby gem:
$ gem install mysql
The process can be sped up somewhat if you do not need local documentation:
$ gem install mysql --no-rdoc --no-ri
The gem will now be downloaded, compiled if necessary, and installed.
Bundler installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of Ruby on Rails applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier. To install:
$ gem install bundler
Bundler seems to want to install gems system-wide, contrary to the current default behaviour of gem itself on Arch. To correct this, add the following line to your
To start a new bundle:
$ bundle init
Then add your required gems into "Gemfile" in the current directory (created by bundle init):
gem "rails", "3.2.9" gem "mysql"
Finally, run the following to install your gems:
$ bundle install
Or, alternatively, in order to install locally to
.bundle under the working directory:
$ bundle install --path .bundle
Managing RubyGems using pacman
Instead of using the gem command directly you can use pacman to manage the installed gems like normal packages. There are a lot of ruby packages available from AUR. Ruby packages follow the naming convention ruby-[gemname]. As an alternative you can use the tool AUR which automatically creates arch packages from gems and installs them afterwards using pacman.
--user-installcommand line switches, bypassing the global setting found in
/etc/gemrcor the users own
~/.gemrc. You're editing the PKGBUILD file before you install, right?