Build Ruby with YJIT and Rbenv
First check you haven’t already done it
ruby -v --yjit
ruby: warning: Ruby was built without YJIT support. You may need to install rustc to build Ruby with YJIT.
Nope.
Prerequisites
- Rust install ✅
rustup update
brew update && brew upgrade ruby-build
RUBY_CONFIGURE_OPTS="--enable-yjit" rbenv install 3.4.1
ruby -v --yjit
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin24]
Success!
I ran some of the tests from my Beginners Guide to Ruby on Rails Performance post and the numbers are noticeably better for the benchmarks where code gets a chance to warm up.