I recently needed to do a small scripting job in Ruby, and to use the gems required I needed to be on the latest version of Ruby (2.4.1). My MacBook was on an older version, so I needed to run a quick update. Here is the process I followed:
1. Check the version of Ruby installed on your Mac
Open terminal and type:
ruby -v
2. Install the Ruby Version Manager rvm
In terminal, curl -L https://get.rvm.io | bash -s stable
Once this command has finished running you may need to restart your terminal for rvm to be recognised.
3. Install the latest version of Ruby
rvm install ruby-[version]
In my case this was
rvm install ruby-2.4.1
This took a while to run as it had to install a lot of dependencies and asked for my permission a couple of times.
4. Set the latest version of Ruby as the one you want to use
You should now be running the latest version of Ruby. You can check as before with the ruby -v command as in step 1. If you’re find that you’re not, you can set this manually. In terminal type:
rvm use ruby-2.4.1
If you want to set this latest version of Ruby as the default version, in terminal type:
rvm --default use 2.4.1
Don’t forget to replace 2.4.1 with the version number of your latest Ruby.
Hope this is helpful for someone.
Thanks!
Glad it was helpful!
This worked perfectly for me! Thanks so much.
I’m glad to hear, thank you for the feedback 🙂
thanks for your help
Glad you found it helpful 🙂
Thank you, this was great.
Thank you for the feedback, glad it was helpful! 🙂
Awesome !
so how can i know the latest Ruby is 2.4.1? how can i check the latest number?
please advise thanks
You can find the latest version of Ruby (as well as the preview version, the security maintenance only version, etc.) by checking the official Ruby website (the downloads page is where I go) – https://www.ruby-lang.org/en/downloads/. For example as of today the latest stable version is 2.4.2.
Very helpful. Thank you!
It sure helped me out tons! Thanks!
Worked great thanks!
Thanks for this – super useful!
Thanks for the info! Very helpful
Thank you!
Thank you so much.
You are most welcome, glad the post was helpful. And thank YOU very much for the beer 🙂 Much appreciated!
Thanks!
Thank you! It was helpful!
Thank you!
Thanks for sharing… that was just very useful to me!
You’re welcome! Glad it was helpful!!
I really appreciate your help :). Thank you so much for helping me begin my journey to learning code.
You are very welcome! Enjoy your journey 🙂
Thank you!!
This just helped me update to Ruby 3 in 2021 🇿🇦
Thank you! I’m happy to know it’s still relevant and helpful!
Thanks for this post!
Thank you sir. Helped me a lot!