Skip to content

Pack Ruby scripts and applications into fully-featured Mac applications.

License

Notifications You must be signed in to change notification settings

timkoi/MarbleRuby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MarbleRuby

MarbleRuby is an experimental project that allows you to pack your Ruby applications with a compiled Ruby runtime and with all the dependencies into a single macOS .app file. This means that any user of macOS can use your application without installing RVM or Ruby manually.

THIS PROJECT IS EXPERIMENTAL AND MIGHT HAVE BUGS. If you do find them, create a bug report on either GitHub or GitLab.

Installation

Just copy over "app_template" and "bundle.rb" to a folder called "marbleruby" in your home directory:

$ mkdir -v -p $HOME/marbleruby
$ cp -r -v app_template $HOME/marbleruby/app_template
$ cp -v bundle.rb $HOME/marbleruby/bundle.rb

Don’t forget to install the plist gem afterwards:

$ sudo gem install -N plist

Usage

Your Ruby project needs to have a file called "marbleruby.plist" in its root directory. This is a config file that contains information such as Ruby version to pack and use to run the app, app’s dependencies (gems) as well as some other info. To generate a brand new "marbleruby.plist" in PWD, run this command
$ ruby ~/marbleruby/bundle.rb init

Make changes to the generated plist file where necessary, then run this command to package the app:

$ ruby ~/marbleruby/bundle.rb marbleruby.ru

A folder called "macos-bundle-bin" will be created and the resulting .app file will be placed there. When you run it, a Terminal.app window should appear and you should see your app working just fine.

NOTE Set the <key>terminal</key> option to `</false> (without quotes) if your app has a GUI and you don’t want the Terminal.app window to appear when the user runs your app.

Building a standalone Ruby bundle

If you just to want to pack the Ruby runtime of a specific version into a .app file, then use one of the .ru files from the "standalone-rubies" folder to build either a Ruby 2.4, 2.5 and 2.6 distribution.

For example, to build Ruby 2.5 and pack it into an app called Ruby2.5.app, run:

$ ruby ~/marbleruby/bundle.rb standalone-rubies/ruby2.5.ru

The produced binary can be found in "standalone-rubies/macos-bundle-bin" and, when you run it, Interactive Ruby will start in a new terminal window.

Limitations

  • Currently, the binaries produced can only work on the version of macOS that you’ve used to build the .app bundle and higher. For example, if you use macOS 10.14 to build the binaries, then the produces binaries will work on macOS 10.14 and newer and won’t work on macOS 10.13 or older. While this can be fixed with some linker flags, I haven’t yet got Ruby 2.1 or newer to link statically or link with additional Clang flags (such as -mmacosx-version-min=10.9).

  • Ruby 1.8 and older are not supported yet.

  • Currently, you have to sign the produced binaries manually.

  • Building Ruby interpreters other than Ruby MRI or YARV is not supported.

License

See LICENSE for more info.

The project is inspired by https://github.com/gosu/ruby-app.

About

Pack Ruby scripts and applications into fully-featured Mac applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published