Check out example codes for "install ruby mac". It will help you in understanding the concepts better.
Code Example 1
brew install ruby
Code Example 2
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Learn ReactJs, React Native from akashmittal.com