Using Ruby for Sega Dreamcast development
It is possible to develop in Ruby for the Sega Dreamcast system using the mruby implementation. This support was originally introduced by Yuji Yokoo in 2019.
Like most Sega Dreamcast software, this project uses KallistiOS (KOS) as its base.
Note: Debugging support has not been tested as of 2025.
Prerequisites
- A working KallistiOS environment must be set up, including all necessary dependencies for building KallistiOS;
- You must build the KallistiOS library;
- You must have both ruby and bison installed (see the sections below).
Installing prerequisites on Cygwin
Launch the Cygwin setup utility, search for the ruby and bison packages, and install them.
Installing prerequisites on DreamSDK
Depending on the underlying environment installed with DreamSDK, there are 2 possible cases:
If you are using the modern MinGW-w64/MSYS2 foundation
No additional prerequisites are required — both Ruby and Bison are already preinstalled.
If you are using the legacy MinGW/MSYS foundation
Install manually the prerequisites:
- Install RubyInstaller, and ensure that the ruby command is available in your system PATH;
- Use the MinGW Installation Manager to install the msys-bison-bin package.
Note: If you are using DreamSDK on Windows XP, you should install Ruby version 2.0.0 from RubyInstaller, as it is the last version compatible with that operating system.
Installing prerequisites on GNU/Linux
Use your distribution’s package manager to install the ruby and bison packages (e.g., run apt install ruby bison on Debian/Ubuntu).
Installing prerequisites on macOS
Install the ruby and bison packages using your preferred package manager (e.g., brew).
Installing prerequisites on MinGW-w64/MSYS2
Run the following command in the MSYS2 shell:
pacman -S ruby bison
Setting up mruby
The recommended way to use mruby on Dreamcast is to install the mruby port from the KallistiOS Ports repository.
First of all, make sure to clone the kos-ports repository:
cd /opt/toolchains/dc git clone https://github.com/KallistiOS/kos-ports.git .
Then, run the following commands:
cd /opt/toolchains/dc/kos-ports/mruby make install clean
This will build the embedded mruby library (libmruby.a) along with the required host tools (mainly /opt/toolchains/dc/bin/mrbc) for the Dreamcast platform.
Note: The configuration file is stored in build_config/dreamcast_shelf.rb in the mruby official repository.
Using mruby in a Sega Dreamcast project
Two example projects are included with KallistiOS in the /examples/dreamcast/mruby directory:
- dreampresent – A simple presentation tool (this needs the libpng port as well);
- mrbtris – A sample game.
These examples were originally developed by Yuji Yokoo and correspond to the earlier stand-alone repositories. You can build them using the standard make command (assuming mruby and any additional required ports are properly installed via kos-ports).