Skip to content

Instantly share code, notes, and snippets.

@stvnrynlds
Forked from DirtyF/README.md
Last active November 5, 2018 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stvnrynlds/ce4999d3175bf41ff083d5e4665ab382 to your computer and use it in GitHub Desktop.
Save stvnrynlds/ce4999d3175bf41ff083d5e4665ab382 to your computer and use it in GitHub Desktop.
Setup ruby with brew and rbenv

First, make sure you have command line tools installed:

xcode-select --install

Then open Terminal.app and type:

curl https://gist.githubusercontent.com/stvnrynlds/ce4999d3175bf41ff083d5e4665ab382/raw/085b17e1fb8bc00bbc408a4ccb2b808a5e3b0f15/setup-rbenv.sh | bash
#!/bin/bash
set -ex
brew update
brew install rbenv ruby-build
rbenv install 2.5.3
echo "export GEM_HOME=$HOME/gems" >> ~/.bashrc
echo "export PATH=$HOME/gems/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
rbenv global 2.5.3
rbenv rehash
ruby -v
if ! type rbenv | grep function; then
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
fi
set +x
echo "Done! Close and reopen your terminal"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment