How to setup ruby development for mac
To set up Ruby development on a Mac, there are several steps that need to be followed.
However, if you only want to experiment with Ruby language and don’t require multiple versions of Ruby,
you can use Homebrew to install Ruby and explore Ruby’s magic.
Simply use Homebrew to install Ruby and get started!
use homebrew to install ruby
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install ruby
And if require to use multiple versions of ruby then a version manager like rbenv or RVM will help
you. you can follow the below steps:
Install Xcode Command Line Tools
xcode-select --install
use ruby package manager
I am using rvm package manager
\curl -sSL https://get.rvm.io | bash
source ${HOME}/.rvm/scripts/rvm
rvm -v # should return the rvm version details
setup rvm
First install GPG keys
# more detials about rvm here https://rvm.io/rvm/install
# install rvm
\curl -sSL https://get.rvm.io | bash
# load rvm in current open terminal window
source ${HOME}/.rvm/scripts/rvm
# check rvm vesion
rvm -v
Install ruby
we will be using the latest ruby available for the development
and old version might not work based on your mac os version :(
rvm list known
will return all available ruby versions for your system
# list all available ruby versions for the current system
rvm list known
rvm install ruby-3.0.2
install Bundler
Bundler is a dependency manager for Ruby projects.
gem install bundler
Now you have Ruby installed on your Mac, and you can start developing Ruby applications