dev notes - ruby install (mac os)

notes for when I'm setting up a new development environment

make sure you have brew already installed. then run:

brew install rbenv ruby-build

This will install rbenv, which will allow you to manage your ruby versions. Initialize rbenv with the following command (you’ll have to follow the instructions and restart your terminal after applying the changes

rbenv init

For further reference, check the link below:

After rbenv is set up, let’s install a ruby version to work with (you can list available versions using `rbenv install -l` )

rbenv install 3.1.2

After the installation is done, check the active Ruby version with `rbenv version` (please note that when you execute `rbenv —version`, you get the version for rbenv, not Ruby)

If you get `local`, set the version you just installed as active with this

rbenv local 3.1.2

The output for `rbenv version` should look like this

3.1.2 (set by /Users/frank/.ruby-version)

Let’s install Rails:

sudo gem install rails

You should now be able to create a new Rails project by running `rails new <project>`. If you get an openssl related error, you should also set ruby to use the openssl version installed by brew instead of the system default:

export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"

rails new fails with 'couldn't set additional authenticated data' on macos

Restart your terminal and you should be ready to go.