← til

Compiling latest Ruby from scratch with chruby

March 1, 2020
ruby

Since chruby officially does not support compiling latest Ruby (HEAD), here are the steps necessary to do it.

Current HEAD version of Ruby is 2.8.0dev, so that's the version being compiled in this example. The only thing necessary for your custom compiled Ruby to play nicely with chruby is passing the --with-dest-dir option to configure. This allows chruby to find this newly compiled version, so you can switch to it and use it.

git clone https://github.com/ruby/ruby.git
cd ruby
./autoconf
./configure --with-dest-dir="$HOME/.rubies/ruby-2.8.0dev"
make
make install

After restarting the shell, you will be able to use this ruby version with:

chruby 2.8.0dev