Distributing Stand-Alone Applications on Mac OS X

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Distributing Stand-Alone Applications on Mac OS X

Post by bmelts » Tue Jul 07, 2009 6:04 am

It took me several hours and has left me with a nasty headache, but I managed to figure out all the hoops one has to jump through to create a standalone application of your .love that can be distributed to OS X users! Below is the 12-step tutorial (the steps are small, don't worry!):

First, make a copy of love.app, and make sure you have a .love of your game. For this tutorial, I'll be using a fresh copy of love.app and examples.love, newly downloaded:
Image

Once you have those (remember, use a copy of love.app, not your original), right-click (or control-click) on love.app, select "Show Package Contents", and expand the Contents folder, followed by the MacOS folder. Your window should look something like this:
Image

Open up Terminal (it can be found in the Utilities folder, in your Applications folder), type "cd " (without the quotes), and then drag the MacOS folder from the Finder onto the Terminal window - it will automatically put in the full path. Hit enter once you've done that.
Image

Next, type "cat " (again, without the quotes). Drag the "love" icon inside the MacOS folder onto the Terminal window, followed by your .love file. DON'T hit enter yet.
Image

Type "> " (I'm going to stop reminding you about the quotes now :P), followed by the name of your .love file, without the .love. So, since mine is called "examples.love", I type "examples". I'm going to refer to this as the name of your project. NOW you can hit enter.
Image

Okay, next, type "chmod u+x " followed by the name of your project. Hit enter.
Image

We're done in Terminal! You can quit it now. If you go back to the Finder window, you'll notice there's something new in the MacOS folder...
Image

We don't want the love inside the MacOS folder anymore, so get rid of it. You can drop it in the Trash if you want, or drag it to another folder, but either way, you need to remove it from the MacOS folder.
Image

See that file there, Info.plist? We need to modify it. If you have the Mac OS X Developer Tools installed, you'll have a very useful application called Property List Editor. I'm going to assume you don't, though, and edit it in TextEdit. So, open up TextEdit, and open Info.plist with it:
Image

There's a lot of cryptic-looking text there. Most of it, we don't care about. We're looking for one specific line. Scroll down until you find the line that has "CFBundleExecutable" in it:
Image

See the "love" below it? Change that to the name of your project.
Image

Save and quit TextEdit. Only one more thing to do: back in Finder, change the name of the application from "love" to the name of your project.
Image

And you're done! Here's a screenshot of my new examples.app running on a computer that has never had LÖVE installed on it:
Image
:ultrahappy:

For your testing pleasure, you can download a .dmg of examples.app here, and verify that it works for you.

User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Super Sëxy Bonus Stuff

Post by bmelts » Tue Jul 07, 2009 6:10 am

There are a few extra things you can do in Info.plist to make it a more seamless OS X experience:

Change the displayed name
If you run your .app after following the instructions above, you'll notice it still says "love" in the menubar where the name of the application is. This isn't a big deal if you're running fullscreen, but if you're not, you might want to change it. You can do that by going to the line where it says "CFBundleName" and changing the "love" below that to whatever you want:
Image

Don't open .love files
If someone downloads your application and double-clicks on a .love file, your .app will try to open it. Unfortunately, it won't work. This is not desirable behavior. To change it, go to the part of Info.plist where it says <array>, and delete everything between <array> and </array>:
Image

This will prevent your application from trying (and failing) to open .love files on its own.

User avatar
Tenoch
Citizen
Posts: 76
Joined: Mon Jul 21, 2008 7:49 am

Re: Distributing Stand-Alone Applications on Mac OS X

Post by Tenoch » Tue Jul 07, 2009 6:31 am

Funny, I had tried to do that and failed miserably. Probably missed something. Good to know that it in fact works!

For the sëxy stuff, you can also change the icon, by putting it in the Resources folder of the bundle, and setting the right name in the plist at CFBundleIconFile. Icons for Mac OS X are ICNS format, made for instance with IconComposer, or some converters found on the web.
Beware that it is generaly updated only after copying the bundle once.
"When in doubt, use brute force." Ken Thompson

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Distributing Stand-Alone Applications on Mac OS X

Post by appleide » Tue Jul 07, 2009 2:03 pm

Lovely. I have never successfully done it by combining binaries. I shall follow your guide first thing in the morning.

This thread should be stickied!

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Distributing Stand-Alone Applications on Mac OS X

Post by appleide » Thu Jul 09, 2009 5:55 am

Hey! How come the images disappeared :(

User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Distributing Stand-Alone Applications on Mac OS X

Post by bmelts » Thu Jul 09, 2009 6:26 am

ack, sorry, my webhost has been having a little trouble :(

They should be up now (and if not, it's not my fault! :P)

User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Distributing Stand-Alone Applications on Mac OS X

Post by appleide » Thu Jul 09, 2009 8:33 am

Okay!!! I've followed this just now, and it works perfectly!!! Awesome!!!! :megagrin:

User avatar
Gruni
Prole
Posts: 6
Joined: Sat Jan 31, 2009 8:54 am
Location: Nehren, BW, Germany
Contact:

Re: Distributing Stand-Alone Applications on Mac OS X

Post by Gruni » Thu Jul 09, 2009 8:48 am

Hey hey, great thing, dude. I made a screencast to show this in motion. :) You can watch it here on Vimeo:

http://vimeo.com/5520116

Otherwise you can download the video here:

http://www.acrowdapart.net/files/screen ... akeapp.mov

Have fun and thanks again, anjo. =)

User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Distributing Stand-Alone Applications on Mac OS X

Post by bmelts » Thu Jul 09, 2009 3:48 pm

Gruni wrote:Hey hey, great thing, dude. I made a screencast to show this in motion. :) You can watch it here on Vimeo:

http://vimeo.com/5520116
Oh wow, that's great! Much easier to follow than static images :)

User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Distributing Stand-Alone Applications on Mac OS X

Post by bmelts » Thu Aug 27, 2009 8:59 pm

Tenoch wrote:For the sëxy stuff, you can also change the icon, by putting it in the Resources folder of the bundle, and setting the right name in the plist at CFBundleIconFile. Icons for Mac OS X are ICNS format, made for instance with IconComposer, or some converters found on the web.
Yeah, I would recommend anyone who wants to make a custom icon for their game on the mac use Img2icns - the free version does everything you need, namely, taking a picture and making an .icns suitable for usage as, say, a game icon.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests