ruby
  1. ruby-installation

Ruby Installation

Ruby is a popular programming language that is used to build a wide range of applications, from website backends to command-line utilities. In this guide, we'll walk you through the steps to install Ruby, so you can start using this language on your development environment.

Installation

There are several ways to install Ruby. Here, we will go through the two most popular methods: using a package manager and installing from source.

Using a Package Manager

macOS

On macOS, you can install Ruby using Homebrew, a popular package manager. To install Homebrew, open the Terminal app and run the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Once Homebrew is installed, you can install Ruby by running:

brew install ruby

Linux

On Linux, the installation process will depend on the specific distribution you are using. In most cases, you can install Ruby using your package manager. For example, on Ubuntu or Debian-based systems, you can install Ruby by running:

sudo apt-get install ruby-full

Installing from Source

If you prefer to install Ruby from source, you can download the latest version from the official Ruby website: https://www.ruby-lang.org/en/downloads/. Once you have downloaded the source code, follow these steps:

  1. Extract the source code to a directory of your choice.
  2. Navigate to the extracted directory.
  3. Run the following commands:
./configure
make
sudo make install

Verification

Once the installation is complete, you can verify Ruby is installed correctly on your system by running the following commands:

ruby -v

This should output the version of Ruby that is installed on your system.

Summary

In this guide, we walked through the steps to install Ruby on macOS and Linux using a package manager, as well as installing from source. After following these steps, you should have Ruby installed and ready to use on your development environment.

Published on: