How to package a Clojure desktop app for Mac OS X?

This is something I unexpectedly couldn’t google quickly. The short answer is:

  1. build uberjar;
  2. package it using javapackager.

Javapackager can be used to create .app, .pkg, .dmg files, and even mac.appStore ones.

Here’s an example of creating an executable .app bundle for my application:

$ lein uberjar
Compiling pickings.core
Compiling pickings.keylistener
Compiling pickings.logic
Compiling pickings.main
Compiling pickings.mvsa
Compiling pickings.ui
Created /Users/yuri/dev/pickings/target/pickings-0.1.0-SNAPSHOT.jar
Created /Users/yuri/dev/pickings/target/pickings-0.1.0-SNAPSHOT-standalone.jar

$ /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/javapackager -deploy -native image -outdir out -outfile pickings.app -srcfiles target/pickings-0.1.0-SNAPSHOT-standalone.jar -appclass pickings.main -name "Pickings" -title "Pickings" -Bruntime= -Bicon=resources/icon.icns
Package is configured to ship without a JRE.
Creating app bundle: /Users/yuri/dev/pickings/out/bundles/Pickings.app

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s