Skip to content
Shannon Skipper edited this page Apr 28, 2026 · 111 revisions

CRuby, also known as MRI (Matz's Ruby Implementation), is the defacto Ruby and sets the standards for other Ruby implementations. CRuby can be installed with tools like ruby-install and ruby-build or Ruby requirements can be manually installed and Ruby can be built from source as shown below.

Requirements

Operating System Command
Debian / Ubuntu
sudo apt install -y build-essential zlib1g-dev libyaml-dev libssl-dev libffi-dev
RedHat / Fedora
sudo dnf install -y gcc automake zlib-devel libyaml-devel openssl-devel libffi-devel
openSUSE
sudo zypper install gcc automake libffi-devel libyaml-devel openssl-devel zlib-devel
Arch Linux
sudo pacman -S gcc make zlib openssl libyaml libffi
FreeBSD
sudo pkg install libffi libyaml openssl
NetBSD
sudo pkgin -y install libffi libyaml openssl
macOS
brew install gmp libffi libyaml openssl zlib
Alpine Linux
sudo apk add gcc g++ make linux-headers zlib-dev openssl-dev

Installation

wget -O- https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.3.tar.xz | tar -xJ
cd ruby-4.0.3
./configure --prefix=/opt/rubies/ruby-4.0.3
make
sudo make install

macOS note: Flags like --with-openssl-dir=... are needed for ./configure to find Homebrew's packages:

curl https://cache.ruby-lang.org/pub/ruby/4.0/ruby-4.0.3.tar.xz | tar -x
cd ruby-4.0.3
./configure \
    --prefix="$HOME/.rubies/ruby-4.0.3" \
    --with-gmp-dir="$(brew --prefix gmp)" \
    --with-libyaml-dir="$(brew --prefix libyaml)" \
    --with-openssl-dir="$(brew --prefix openssl)" \
    --with-zlib-dir="$(brew --prefix zlib)"
make
make install

Clone this wiki locally