How to Install RubyGems on MacOS?
Last Updated :
13 Apr, 2022
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
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
Step 3: Then the following command should be run. It will generate all path environments in the Mac machine.
Cat Users/.bash_profile
Step 4: After running the above command the below output will be there. There 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
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>
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
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
Similar Reads
How to Install RubyGems on Linux? RubyGems is a service for hosting gems of Ruby's community. You can publish your own gem and host it on RubyGems. In this article, we will look into the process of installing RubyGems on a Linux system. Installing RubyGems on Linux: RubyGems can be downloaded from its official website and can be ins
1 min read
How to Install Scala on MacOS? In this article, we are going to show you how you can download and install Scala on your Mac operating system. First of all, you need to download the Java JDK which you can download here Installing Scala on MacOS: Follow the below steps to install Scala on MacOS: Step 1: After installing JDK, run th
2 min read
How to Install Ruby on Rails on MacOS? Ruby on Rails, also known as rails, is a server-side web application development framework written in the Ruby programming language. David Heinemeier Hansson developed it under the MIT License. It supports MVC (model-view-controller) architecture that provides a default structure for databases, web
2 min read
How to install sqlite3 for Ruby on MacOS? In this article, we are going learn how to install SQLite3 for Ruby on MacOS. There are various methods to install SQLite3 for Ruby on MacOS we are going to cover all of them. What is SQLite3?SQLite3 is a versatile and lightweight relational database management system (RDBMS) that plays a pivotal ro
4 min read
How to Install PHP on MacOS? PHP (Hypertext Preprocessor) is known as a general-purpose scripting language that can be used to develop dynamic and interactive websites. It was among the first server-side languages that could be embedded into HTML, making it easier to add functionality to web pages without needing to call extern
3 min read
How to Install Rust in MacOS? Installing Rust on macOS is a straightforward process that allows you to start building fast, memory-efficient applications. This guide will show you how to install Rust using simple commands and set up the Rust programming environment on macOS. Whether you're a beginner or an experienced developer,
3 min read