First, make sure you have command line tools installed:
xcode-select --install
Then open Terminal.app and type:
curl https://gist.githubusercontent.com/DirtyF/5d2bde5c682101b7b5d90708ad333bf3/raw/fbc736fa1b50bd637929a315e6803df306c8bc8e/setup-rbenv.sh | bash
I just ran the commands in
setup-rbenv.sh
, but it turns out that we should run the following command(from this answer on stackoverflow) after installingrbenv
in order to makerbenv global 2.4.3
work:Then reopen terminal.
Or the version of ruby would still be the one pre-installed on macos.