Contents

Native

Learn how to build a native executable of your app

⚠️
Warning: This is experimental! You can try it out, but it may not work well.

Ruby programs are simply text files that can be run by a Ruby interpreter, like MRI / CRuby. Did you know you can also compile your programs to native code using MRuby.

First, you’ll need to install MRuby:

With MRuby installed, using the “Hello Triangle” script you wrote above, run the following to build a native and web-based version of the app:

ruby2d build app.rb

Notice a build/ directory was created containing an executable named either app on Unix-like systems, or app.exe on Windows.

The executable is a compiled, native version of your app. It can run on any system, similar to the one you built it on, without the need for the full Ruby interpreter to be present. Let’s try running the native app on the command line:

# Enter the `build/` directory
cd build

# Run on Unix-like systems
./app

# Run on Windows
app.exe

Continue to the next topic ▸


✏️ Suggest an edit to this page