Page 1 of 3
Super simple script for running love projects on mac
Posted: Mon Jun 10, 2013 10:52 pm
by Johannes
Probably nothing new, but I made this for my own projects and thought it might be useful for anyone that wants an easy way to test their löve project but doesn't want to have to set up anything fancy, use the terminal, or have to drag+drop the folder onto love.app
- run_in_love.zip
- Super simple Löve script for mac
- (671 Bytes) Downloaded 264 times
All you have to do is drop the 'run_in_love' file in the folder with your main.love and double click it.
You can just copy and paste the file into any Love Project and it will just work.
- MZK7YDv.png (10.26 KiB) Viewed 667 times
Here's what the script contains:
Code: Select all
#!/bin/sh
/Applications/love.app/Contents/MacOS/love "${0%/*}"
It really couldn't be much simpler
It just passes the directory that the script is in to the love application (which should be in the applications folder)
Note: If double clicking does not work, you will need to make the 'run_in_love' file executable. You can do this by:
- 1. Opening a new terminal window
2. Typing in 'chmod +x ' (including the last space)
3. Dragging the file into the terminal, which will add its file path, finally pressing enter
Re: Super simple script for running love projects on mac
Posted: Tue Jun 11, 2013 12:01 am
by Jasoco
This is how I do it. Except that I name the file with a .command extension which gives it an icon with the Terminal on it. I then attach that .command file to a hotkey I set up via BetterTouchTool (Command+Shift+R) so I can run it on a whim. Saves me sooooo much time.
Re: Super simple script for running love projects on mac
Posted: Tue Jun 11, 2013 9:49 am
by Johannes
Jasoco wrote:This is how I do it. Except that I name the file with a .command extension which gives it an icon with the Terminal on it. I then attach that .command file to a hotkey I set up via BetterTouchTool (Command+Shift+R) so I can run it on a whim. Saves me sooooo much time.
Ooh, I did not know about .command, that does seem to have some nice benefits like:
- Being able to quick look at the contents (normal shell script will just show 'Exec' icon)
- If permissions are not set it will actually tell the user, and not try to open it in some other application like xcode.
Are there any other benefits to using .command?
Re: Super simple script for running love projects on mac
Posted: Fri Jun 14, 2013 10:20 pm
by Lafolie
Why not use the build system on your text editor? From the editor I use F8 (the Apple keyboard has a play icon on this key), and boom, game. I use a love alias from my .bash_profile, and even outside of the text editor I'm usually cd'd into the project dir if I'm working on it, which means "love ." is all that is needed.
Re: Super simple script for running love projects on mac
Posted: Fri Jun 14, 2013 11:32 pm
by Johannes
Lafolie wrote:Why not use the build system on your text editor? From the editor I use F8 (the Apple keyboard has a play icon on this key), and boom, game. I use a love alias from my .bash_profile, and even outside of the text editor I'm usually cd'd into the project dir if I'm working on it, which means "love ." is all that is needed.
I already have a build script set up for my editor (Sublime Text 2) and I also have the love alias set up in my bash profile.
I don't tend to use the terminal during my day-to-day work, so I'm not CD'd to my project dir, and just like being able to just quickly double clicking a file and it just working. The point here is utter simplicity and no need to set anything up
Re: Super simple script for running love projects on mac
Posted: Sat Jun 15, 2013 12:14 am
by Jasoco
Johannes wrote:...I also have the love alias set up in my bash profile.
Just curious how to go about doing this? So I can just type "love" into the Terminal to have it run the binary without having to use its full path. I can't seem to figure that out so my current run script looks like this:
Code: Select all
#!/bin/bash
~/Documents/Coding\ Projects/LÖVE/Löve\ Apps/love.app/Contents/MacOS/love "${0%/*}"
(I keep my Löve apps in a separate folder to keep them from cluttering up my LaunchPad with apps I can't even launch normally anyway.)
Re: Super simple script for running love projects on mac
Posted: Sat Jun 15, 2013 1:03 am
by Dattorz
I keep a terminal window open to my project directory and just type
and press Enter. Since it gets added to command history, I can just give the terminal window focus, then press Up and Enter to relaunch.
If you aren't on Linux you'll probably need to manually add love to your $PATH environment variable.
Edit: I'm not a Mac user, but I assume one could do something like this on OS X:
Re: Super simple script for running love projects on mac
Posted: Sat Jun 15, 2013 4:36 am
by Jasoco
I don't know how to add love to my OS X path. I even tried Googling. Didn't work.
Re: Super simple script for running love projects on mac
Posted: Sat Jun 15, 2013 1:20 pm
by Lafolie
Open up Terminal and type:
You may want to edit .bash_rc instead, but on 10.6.8 I find that .bash_profile seems to work while others do not.
Anyway, in that file, add the following line:
Code: Select all
alias love='/Applications/love.app/Contents/MacOS/love'
Press Ctrl-X (not Cmd) and then confirm to save.
Re: Super simple script for running love projects on mac
Posted: Sat Jun 15, 2013 5:48 pm
by Dattorz
Why not just put this in your bash profile?
Code: Select all
export PATH=$PATH:/Applications/love.app/Contents/MacOS
After all, that's what $PATH is for.