DEV Community

Joseph Schito
Joseph Schito

Posted on • Edited on

Create a MacOS desktop application with pure Ruby (Tutorial)

This is (for now) a modest step-by-step tutorial about creating a MacOS desktop application with Ruby.
I used Traveling Ruby and Platypus, so it doesn't need any system dependencies to run because it downloads Ruby executables and installs gems in the application bundle.
(I'll try to make it more detailed and add more features in the future).

Tested on Apple M3

1

You have your Ruby application inside a example folder
Image description

2

Create a ruby2pack.rb file outside example
Image description
and fill it with this gist https://gist.github.com/josephschito/96c0e385cb803f3778fb4c40226e64f5

3

From IRB require that file with require ./ruby2pack and run Ruby2Pack.new(source_path: 'example', ruby_version: '3.3.0', platform: 'osx-arm64', rel: '20240215').run.
Test your application execution by running ./dist/osx-arm64-3.3.0-20240215/run

4

Download Platypus from https://github.com/sveinbjornt/Platypus/releases
and run it

5

Image description

Follow the image instructions and then press [Create App]

THE END

That's it! 🎉

Image description

Top comments (3)

Collapse
 
andyobtiva profile image
Andy Maleh • Edited

I was able to follow these instructions successfully to package a Glimmer DSL for LibUI desktop application as a native MacOS Sonoma 14.4.1 desktop application on my M2 Chip MacBook Pro.

Thank you for sharing.

Collapse
 
chipcastle profile image
CHIP CASTLE

Do you have a sample I can review? I was able to get the first 2 tutorials working from Traveling Ruby, but haven't gotten anything working with a Glimmer DSL project. I've modified the ruby2pack.rb somewhat and think I'm getting close. Any suggestions are appreciated. Thanks Andy!

Collapse
 
blag profile image
Alvaro (Blag) Tejada Galindo

Awesome! I need to try this soon! 🤩