It's recommended to add TruffleRuby to a Ruby manager for ease of use.
To add TruffleRuby to rbenv
a symbolic link has to be added to the versions
directory of rbenv:
ln -s path/to/graalvm/language/ruby "$RBENV_ROOT/versions/truffleruby"
To add TruffleRuby to chruby
a symbolic link has to be added to the
$HOME/.rubies
directory:
ln -s path/to/graalvm/language/ruby "$HOME/.rubies/truffleruby"
RVM has a command for adding a precompiled Ruby to the list of available rubies. RVM has to temporarily be patched, due to unsupported openssl.
cd path/to/rvm
echo "diff --git a/scripts/mount b/scripts/mount
index 031a23c..bf1dcb0 100755
--- a/scripts/mount
+++ b/scripts/mount
@@ -182,6 +182,7 @@ __rvm_osx_ssl_certs_ensure_for_ruby_except_jruby()
{
case \"\$1\" in
(jruby*) true ;;
+ (*truffleruby*) true ;;
(*) __rvm_osx_ssl_certs_ensure_for_ruby \"\$2\" ;;
esac
}" | patch -p1
Then rvm mount
can be used.
rvm mount path/to/graalvm/language/ruby -n truffleruby
The name passed with -n
option has to contain truffleruby
.
If you are using a Ruby manager like rvm
, rbenv
, or chruby
and wish not to
add TruffleRuby to one of them make sure that the manager does not set
environment variables GEM_HOME
, GEM_PATH
, and GEM_ROOT
. The variables
are picked up by truffleruby (as any other Ruby implementation would do)
causing truffleruby to pickup the wrong gem-home directory instead of its own.
It can be easily fixed by clearing the environment with one of the following commands:
rvm use system
rbenv system
chruby system
Otherwise, unset the variables with:
unset GEM_HOME GEM_PATH GEM_ROOT
Next step: Installing gems.