Open In App

How to Install RubyGems on MacOS?

Last Updated : 13 Apr, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Ruby is a high-level and open-source programming language. It is very useful in many aspects. Like other programming languages, Ruby is nowadays a highly useful programming language. In Ruby, there is a package manager available which is known as Gems. It is easily distributed and provides libraries to different Ruby programs. For installing Gems, RubyGems is used. Nowadays, RubyGems can be installed along with Ruby. There is no other way to install RubyGems apart from Ruby. RubyGems can also define as the hosting services in Ruby. It helps to run the Gems which are going to publish and install on the machine. Gem is generally a software package. It is used to modify the functions of Ruby applications.

Features:

  • It is widely used for its speed and interactive user interface.
  • Here, every small part of code can have its own properties.
  • It is a highly flexible programming language.

Installation of RubyGems on MacOS

For installing Ruby in Mac, at first most important prerequisite is in the machine there should be homebrew installed previously. Otherwise, it will give an error.

Step 1: The following command should be run in the terminal. It will start downloading and initialize installing Ruby in Mac.

brew install ruby

Install-Ruby-on-Mac

 

Step 2: After installing Ruby on Mac. The path environment should be set in the Mac. Otherwise, it will not run.

echo ‘export PATH=”/usr/local/opt/ruby/bin:$PATH”‘ >> ~/.bash_profile

Setting-environment-path

 

Step 3: Then the following command should be run. It will generate all path environments in the Mac machine.

Cat Users/.bash_profile

Generating-all-path-environment

 

Step 4: After running the above command the below output will be there. There the path for Ruby will also be displayed.

The-path-for-Ruby-will-also-be-displayed

 

Step 5: At last, the following command should be run. It will display the proper version of Ruby installation. With proper installation of Ruby, RubyGems is also installed. Hence installation is successful.

ruby -v

Check-the-version-of-Ruby

 

Install New Gems

For installing a new Gem, the following command should be run. This simple command will create a new Gem in the system.

bundle gem <gemname>

Installing-new-gem

 

Update RubyGems

For updating RubyGems the following command should be run.  It will take some time. Then it will update to the certain version of Gems if it is needed according to the machine configuration.

gem update –system

Update-RubyGems

 

 

List Installed Gems

For listing up the Gems, which have been installed previously the following command should be run. This will list down the Gems name, as shown in the picture below.

gem list

List-of-Gems

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads