- Java Reference
- Java on Truffle
- LLVM Languages Reference
- Python Reference
- Ruby Reference
- Debugging Ruby
- Runtime Configurations
- Using Ruby with GraalVM
- Installing `libssl`
- Installing Make and GCC
- Installing `zlib`
- Migration from JRuby to Ruby
- TruffleRuby Options and Command Line
- Polyglot Programming
- Ruby Managers and Installers
- Standalone Distribution
- Development Tools for Ruby
- Ruby Additional Functionality
- Setting up a UTF-8 Locale
- Reporting Performance Problems
- Optcarrot Example
- R Reference
- WebAssembly Reference
Using TruffleRuby with GraalVM
GraalVM is the platform on which TruffleRuby runs.
Installing GraalVM enables you to run TruffleRuby both in the
--jvm runtime configurations.
TruffleRuby’s dependencies need to be installed for TruffleRuby to run correctly.
Community Edition and Enterprise Edition #
GraalVM is available in a Community Edition, which is open-source, and an Enterprise Edition which has better performance and scalability. See the website for a comparison.
Installing the Base Image #
GraalVM starts with a base image which provides the platform for high-performance language runtimes.
The Community Edition base image can be installed from GitHub, under an open source licence. The Enterprise Edition base image can be installed from Oracle Downloads page by accepting the Oracle License Agreement.
Nightly builds of the GraalVM Community Edition are also available.
Whichever edition you choose, you will obtain a tarball which you can extract.
There will be a
bin directory (
Contents/Home/bin on macOS) which you can add to your
$PATH if you want to.
Installing with asdf #
Installing Ruby and Other Languages #
After installing GraalVM you then need to install the Ruby language into it.
This is done using the
The Ruby package is the same for both editions of GraalVM and comes from GitHub:
gu install ruby
This command will show a message regarding running a post-install script.
This is necessary to make the Ruby
openssl C extension work with your system libssl.
Please run that script now.
The path of the script will be:
# Java 8 jre/languages/ruby/lib/truffle/post_install_hook.sh # Java 11+ languages/ruby/lib/truffle/post_install_hook.sh # Generic $(path/to/graalvm/bin/ruby -e 'print RbConfig::CONFIG["prefix"]')/lib/truffle/post_install_hook.sh
You can also download the latest Ruby component (
ruby-installable-...) manually from GitHub.
Then install it with
gu install --file path/to/ruby-installable-....
If you are installing Ruby into GraalVM Enterprise, then you need to download the Ruby
Enterprise installable from Oracle Downloads page and install using
--file in the same way.
After installing Ruby you may want to rebuild other images so that they can use the new language. Rebuilding the executable images can take a few minutes and you should have about 10 GB of RAM available.
gu rebuild-images polyglot libpolyglot
To be able to do so, you may need to install the
native-image component if you have not done so already:
gu install native-image
Using a Ruby Manager #
Inside GraalVM is a
languages/ruby directory which has the usual structure of a Ruby implementation. It is recommended to add this directory to a Ruby manager.
See configuring Ruby managers for more information.