Ruby ruby-build

From wikinotes
Revision as of 19:54, 29 March 2020 by Will (talk | contribs) (→‎Documentation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Plugin for ruby rbenv that install/manages ruby versions to be used within a project.
Ruby installs are kept in user's home directory.


WARNING:

Does not work for new ruby installs at shopify
dev tool overwrites chruby with an alias that clears $RUBIES envvar.

Instead, manually do echo "2.6.5" > .ruby-version and everything works.

Documentation

github https://github.com/rbenv/ruby-build

Locations

~/.${SHELL}rc add line to
${project}/.ruby-version file contains ruby version to use for this directory (ex: 2.7.0)

Install

# Install ruby-build
sudo port install ruby-build
# install as rbenv plugin
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
# Install ruby build requirements
sudo port install libyaml
sudo port install openssl
sudo port install libffi

Usage

Install/Configure specific ruby versions for a project.

rbenv install -l          # list available ruby versions
rbenv install 1.9.3-p551  # install ruby version into rbenv

rbenv versions            # list installd ruby versions
rbenv local 1.9.3-p551    # set ruby version (for directory: writes .ruby-version)