Skip to content

Instantly share code, notes, and snippets.

@wrburgess
Last active April 6, 2023 15:12
Show Gist options
  • Save wrburgess/a6fc079cee6f14fc601b to your computer and use it in GitHub Desktop.
Save wrburgess/a6fc079cee6f14fc601b to your computer and use it in GitHub Desktop.
Updating Ruby with rvm or rbenv on a Mac

RBENV

  • rbenv install -l
  • rbenv install 2.6.5
  • rbenv local 2.6.5
  • gem install bundler
  • bundle install

RVM

Install RVM if Necessary

  1. Install with curl \curl -sSL https://get.rvm.io | bash -s stable
  2. Source the RVM source ~/.rvm/scripts/rvm

Upgrading Ruby with RVM

  1. Update RVM with rvm get stable --ruby
  2. Tell RVM to install new ruby with rvm install [version_number]
  3. Change the ruby version in the app's .ruby-version file
  4. Change the ruby version in the app's Gemfile
  5. Rebuild your gems with bundle install
  6. Reload your terminal with source ~/.bash_profile
  7. Confirm ruby version changed with ruby -v

CI Environment

  1. Ignore unless you manage this aspect of the project
  2. Change the ruby version in Codeship/Travis

Error Messages

If you receive the message:

You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

run sudo gcc, hit Enter, type q, type agree, type Enter

@Waleeta
Copy link

Waleeta commented Dec 6, 2018

Should be gem install bundler.

@mitchnick
Copy link

mitchnick commented Jan 23, 2019

If you have installed rbenv through brew, it is best to run this first:

brew upgrade rbenv ruby-build

I found not all of the ruby versions available for install were updated correctly without running that command first.

@shivanraptor
Copy link

The command should not be username-specific. It should be:

source ~/.rvm/scripts/rvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment