MacOS High Sierra has Ruby 2.3 installed and El Capitan has Ruby 2.0 - both these should be sufficient for most exercises, but if you would like to install a different version or have an older operating system then follow the instructions below.
Note: these instructions may vary between laptops depending on existing configuration.
- Install Xcode command line tools / accept licence
Run xcodebuild -license accept
and xcodebuild -license accept
to ensure prerequisite tools are present
-
Open Terminal (Applications->Utilities->Terminal)
-
Install Homebrew - package management, makes installing Ruby and any subsequent applications easy
Visit Homebrew Copy and paste the line of code into terminal window and hit return
- Install Ruby
After the Homebrew installation is complete and successful, install Ruby by typing the following into the terminal window and pressing return
brew install ruby
- Test
Test the Ruby installation by typing these lines into the terminal window and pressing return.
Display the Ruby version:
ruby -v
Print a "hello world" message
ruby -e 'puts "hello world!"'
TBC