How to install RubyGems on Linux

Last updated on September 24, 2020 by Dan Nanni

Question: I am trying to install a Ruby application package from RubyGems, but I'm getting the following error when attempting to install a Ruby package. How can I install RubyGems on [insert your Linux distro]? "bash: gem: command not found"

RubyGems is a package manager for building, uploading, downloading and installing Ruby packages (also called Gems). When you install a Gem package, RubyGems automatically downloads and installs the Gem and all its dependencies/libraries.

Here is an instruction on how to install RubyGems on various Linux distros. When you install RubyGems, you also want to install Ruby development environment as well, which is needed to build Ruby extensions which are typically written in C language.

Install RubyGems on Ubuntu, Debian or Linux Mint

$ sudo apt-get install rubygems ruby-dev

Install RubyGems on CentOS, Fedora or RHEL

$ sudo yum install rubygems ruby-devel

Install RubyGems on Arch Linux

On Arch Linux, RubyGems is included in the ruby package. So install ruby package from AUR. Then install development tools as well:

$ sudo pacman -S base-devel

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean