Ruby Notebook Chronicles
Explore Ruby the Interactive Way — Pure Ruby Series — Episode 2
✨ A Hands-On Journey Through the Ruby Language Using Jupyter Notebooks
👉Click here to view the full interactive notebook for this episode.
— -
Welcome to **Ruby Notebook Chronicles**, a practical and interactive way to (re)discover the Ruby programming language. Whether you’re new to Ruby or revisiting its expressive syntax and elegant design, this series of Jupyter notebooks invites you to **learn by exploring**.
Each episode is crafted to help you write cleaner code, understand Ruby’s core concepts, and have fun along the way — all within a live coding environment powered by the IRuby kernel in Jupyter.
Use it as a study guide, a playground, or a refreshing deep dive into one of the most developer-friendly languages out there.
— -
🔧 Getting Started on Ubuntu: Ruby in Jupyter
Note: See my repo too
To run Ruby inside a Jupyter Notebook, you’ll need to install the **IRuby kernel**. Here’s how:
1.Install System Dependencies
sudo apt update
sudo apt install ruby ruby-dev build-essential libzmq3-dev libtool pkg-config2. Install Jupyter Notebook
Using pip:
pip install notebookOr, if using Anaconda:
conda install -c conda-forge notebook3. Install and Register the IRuby Kernel
gem install iruby
iruby register --force💡 Tip: If you get an error about Bundler, try gem install bundler first.
4. Launch the Notebook
jupyter notebookYou should now see “Ruby” as an available kernel!
📚 Ruby Episodes
Each episode is a focused lesson or theme in Ruby, written in notebook format:
00 — Map, Reduce & Select — Mastering Enumerable Methods
01 — Map, Reduce & Select — Complex Solutions
02 — Ruby Syntax — Review in Jupiter Notebook (this one)
🙏 Thank You
Thank you for joining me on this journey through the world of Ruby — one notebook at a time.
Whether you’re revisiting old concepts or discovering new ones, I hope these episodes spark curiosity, sharpen your skills, and inspire you to keep coding with joy and clarity.
Feel free to share, fork, or contribute. And most importantly — keep exploring!
🧠💎✨
— J3, The Arduino Hobbyist
🔍 Note 1:
I set up Jupyter Notebook in a virtual environment on my machine. Below is a quick summary of the installation process:
✅ Clean Script: Install Jupyter and IRuby Kernel (Linux)
# 1. Create a Python virtual environment for Jupyter
python3 -m venv ~/.venvs/jupyter
source ~/.venvs/jupyter/bin/activate
# 2. Update system packages
sudo apt update -y
# 3. Install ZeroMQ development headers (Ubuntu/Debian)
sudo apt install -y libzmq3-dev
# (Optional) If you're on Fedora or using dnf-based systems instead of apt:
# sudo dnf install -y zeromq-devel
# 4. Install Jupyter Notebook in the Python virtual environment
pip install --upgrade pip
pip install notebook
# 5. Install and register the IRuby kernel (Ruby must already be installed)
gem uninstall -aIx ffi-rzmq-core ffi-rzmq || true
gem install ffi-rzmq
gem install iruby
iruby register --force
# 6. Launch Jupyter Notebook
jupyter notebook
# 7. Reinicialize the .env
source ~/.venvs/jupyter/bin/activate
jupyter notebookYou should see:
[I 2025-06-12 16:55:26.980 ServerApp] Jupyter Server 2.16.0 is running at:
[I 2025-06-12 16:55:26.981 ServerApp] http://localhost:8888/tree?token=392c4c5e97b45d3b4e07115d2ca46cb164d41ed1fd84de56
[I 2025-06-12 16:55:26.981 ServerApp] http://127.0.0.1:8888/tree?token=392c4c5e97b45d3b4e07115d2ca46cb164d41ed1fd84de56
[I 2025-06-12 16:55:26.981 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).- The script assumes you are using Ubuntu/Debian (
apt). If you are on Fedora, comment out theaptlines and usednf. - The
gem uninstallline uses-aIxto cleanly remove both gems if they exist (|| trueavoids failure if they're not installed). iruby register --forceensures IRuby is added to Jupyter's kernel list.jupyter notebooklaunches the notebook with both Python and Ruby kernels (if Ruby is set up correctly).
🔍 Note 2:
Installing on a fresh Ubuntu 25.04
Get J3’s stories in your inbox
Join Medium for free to get updates from this writer.
🚀 Installation Instructions
1️⃣ Install Ruby and RubyGems
On Ubuntu/Debian:
sudo apt update
sudo apt install ruby ruby-dev build-essential -yVerify:
ruby -v
gem -vThese should print the Ruby and RubyGems version.
2️⃣ Create a clean Python virtualenv for Jupyter
Remove your broken venv if it exists:
rm -rf ~/.venvs/jupyterCreate it again:
python3 -m venv ~/.venvs/jupyter
source ~/.venvs/jupyter/bin/activateConfirm you’re in the venv:
which python
which pipBoth paths should point to ~/.venvs/jupyter/bin/….
3️⃣ Install Jupyter Notebook
In the activated venv:
pip install — upgrade pip
pip install notebookVerify:
jupyter — version4️⃣ Install and register IRuby kernel
Now install required Ruby gems:
gem install ffi-rzmq
gem install iruby
iruby register — forceRun this:
export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATHThen try:
which irubyYou should see something like:
/home/jaythree/.local/share/gem/ruby/3.3.0/bin/irubyThen:
5️⃣ Run Jupyter Notebook
Still inside the virtualenv:
jupyter notebookIn your browser, you should now see Jupyter with Ruby as a selectable kernel.
🧹 Notes:
Every time you want to use Jupyter with IRuby, you need to activate your venv first:
source ~/.venvs/jupyter/bin/activate
jupyter notebookNote ³
Install JupyterLab via APT in Zorin
O.S.: Zorin OS 18 Core
CPU: Intel® Core™ i7–9750H (12 threads)
RAM: 8 GBOn Terminal, Type:
pipx install jupyter --include-deps
which jupyter
jupyter --version
jupyter kernelspec list
gem install iruby
iruby register --force
jupyter kernelspec list
pipx install jupyter --include-deps
which jupyter
jupyter --versionRun:
jupyter notebook









