Update Ruby With Homebrew

This article will tackle how to update Ruby using Homebrew.

Update Ruby Using Homebrew

When we are working on commercial applications that will be used worldwide or that need to be maintained, It is best to keep the version of Ruby updated. With the updates to the application’s language and structure, it becomes more secure and difficult to get hacked or miss used.

To maintain the security and performance of these applications, we need to keep in the loop with the updates of languages and what features they are providing improvements. We can update Ruby in any project or application, or We can update Ruby for our device, which will implement the updates to all the projects.

We can easily update Ruby using Homebrew by using the update command of the brew, as shown below.

# Ruby
brew update

Once we have updated the Homebrew, we can update the Ruby version using the command below.

# Ruby
brew upgrade ruby-build

Now, we will install the Ruby environment using the following command.

# Ruby
brew install rbenv

Using the Ruby environment, we can install the latest version of Ruby by running the commands below.

# Ruby
rbenv install 3.1.2
rbenv global 3.1.2

By using these steps, we can update the version of Ruby.

Write for us
DelftStack articles are written by software geeks like you. If you also would like to contribute to DelftStack by writing paid articles, you can check the write for us page.