Ruby (original) (raw)
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 bison zlib1g-dev libyaml-dev libssl-dev libreadline-dev libffi-dev |
RedHat / Fedora | sudo dnf install -y gcc automake bison zlib-devel libyaml-devel openssl-devel readline-devel libffi-devel |
openSUSE | sudo zypper install gcc automake bison libffi-devel libyaml-devel openssl-devel readline-devel zlib-devel |
Arch Linux | sudo pacman -S gcc make bison zlib openssl readline libyaml libffi |
FreeBSD | sudo pkg install bison libffi libyaml openssl readline |
NetBSD | sudo pkgin -y install bison libffi libyaml openssl readline |
macOS | Install Homebrew brew install bison gmp jemalloc libffi libyaml openssl readline zlib |
Alpine Linux | sudo apk add gcc g++ make linux-headers zlib-dev openssl-dev readline-dev |
Installation
wget https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.2.tar.xz
tar -xJvf ruby-3.4.2.tar.xz
cd ruby-3.4.2
./configure --prefix=/opt/rubies/ruby-3.4.2
make
sudo make install
Note: macOS users must properly specify ./configure --with-openssl-dir=... --with-opt-dir=...
to compile Ruby against Homebrew's packages:
curl https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.2.tar.xz | tar -x
cd ruby-3.4.2
./configure \
--prefix="$HOME/.rubies/ruby-3.4.2" \
--with-gmp-dir="$(brew --prefix gmp)" \
--with-libyaml-dir="$(brew --prefix libyaml)" \
--with-openssl-dir="$(brew --prefix openssl)" \
--with-readline-dir="$(brew --prefix readline)" \
--with-zlib-dir="$(brew --prefix zlib)" \
--with-opt-dir="$(brew --prefix jemalloc)" \
--with-jemalloc
make
make install