Skip to content

Instantly share code, notes, and snippets.

@yorkxin
Last active May 24, 2022
Embed
What would you like to do?
Config rbenv to use Homebrew-installed Ruby

A workaround for developers who cannot build Ruby from source code on their machine.

brew install ruby@<version>
ln -s $(brew --prefix ruby@<version>) ~/.rbenv/versions/<version>

For exmaple

brew install ruby@3.1
ln -s $(brew --prefix ruby@3.1) ~/.rbenv/versions/3.1

Caveats:

  • Homebrew always install the latest patch version of a given Ruby version. If your .ruby-version locks at the patch version (e.g. 3.1.2), change it to minor version (3.1) or change the symlink to 3.1.2.
  • Homebrew does not distribute dead versions of Ruby, such as 2.3 at the time of this writing. If you must use it, try build from tarball, ruby-build, ruby-install or rvm. Alternatively, try using a Docker container for development with RubyMine.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment