![]() With rbenv, you can easily switch between different Ruby versions whenever you need to. That’s it! You’ve successfully updated your Ruby version on your Mac. With this, Homebrew will go out and fetch not only Ruby but also any dependencies Ruby needs to run. The command is pretty straightforward: brew install ruby. Alright, so now that Homebrew is installed, we can use it to install a newer version of Ruby. If everything went well, you should see the new version number in the output. Step 3: Use the Package Manager to Install Ruby. To ensure that you’re using the new Ruby version, run the following command: ruby -v You can replace 2.7.2 with the version number you installed. This will set Ruby 2.7.2 as the default version for your system. To start using the newly installed Ruby version, run the following command: rbenv global 2.7.2 You can replace 2.7.2 with the version number you want to install. This will install Ruby 2.7.2 on your system. Once you know the latest version, install it using the rbenv install command followed by the version number: rbenv install 2.7.2 Step 2: Install a new Ruby versionįirst, check the latest stable Ruby version by visiting the official Ruby website: Now, restart your terminal or run source ~/.bash_profile (or the respective file) to apply the changes. bashrc file (based on the shell you use): if which rbenv > /dev/null then eval "$(rbenv init -)" fi Once the installation is complete, add the following line to your. Run the following command in your terminal to install both: brew install rbenv ruby-build Moreover, we will also need the ruby-build plugin to install new Ruby versions. We will use rbenv to manage multiple Ruby versions on our Mac. Ruby brew upgrade ruby-build Now, we will install the Ruby environment using the following command. Ruby brew update Once we have updated the Homebrew, we can update the Ruby version using the command below. If you haven’t installed Homebrew yet, visit and follow the instructions. We can easily update Ruby using Homebrew by using the update command of the brew, as shown below. Homebrew: Homebrew is a package manager for macOS that allows you to install various software and tools.You can check if you have them installed by running xcode-select –install in your terminal. Its fine to use the system Ruby for running sysadmin scripts, as long as you dont alter the system Ruby by attempting to update it or add gems. If you see /usr/bin/ruby, it is the pre-installed macOS system Ruby. Use the which command to see where Ruby is installed: which ruby /usr/bin/ruby. Xcode Command Line Tools: It is essential to have Xcode’s command-line tools installed to compile Ruby. MacOS comes with a 'system Ruby' pre-installed.Prerequisitesīefore we begin, make sure you have the following installed on your Mac: Are you still using an older version of Ruby and looking to update it to the latest version on your Mac? You’ve come to the right place! In this blog post, we will walk you through the process of updating Ruby on your Mac.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |