Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created November 11, 2010 16:03
Show Gist options
  • Select an option

  • Save subtleGradient/672684 to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/672684 to your computer and use it in GitHub Desktop.
appify. Create the simplest possible mac app from a shell script
#!/usr/bin/env bash
#
# url : https://gist.github.com/672684
# version : 2.0.2
# name : appify
# description : Create the simplest possible mac app from a shell script.
# usage : cat my-script.sh | appify MyApp
# platform : Mac OS X
# author : Thomas Aylott <oblivious@subtlegradient.com>
APPNAME=${1:-Untitled}
if [[ -a "$APPNAME.app" ]]; then
echo "App already exists :'(" >&2
echo "$PWD/$APPNAME.app"
exit 1
fi
mkdir -p "$APPNAME.app/Contents/MacOS"
touch "$APPNAME.app/Contents/MacOS/$APPNAME"
chmod +x "$APPNAME.app/Contents/MacOS/$APPNAME"
DONE=false
until $DONE ;do
read || DONE=true
echo "$REPLY" >> "$APPNAME.app/Contents/MacOS/$APPNAME"
done
echo "$PWD/$APPNAME.app"
@andreif

andreif commented Jun 6, 2015

Copy link
Copy Markdown

It wouldn't work on OS X 10.10 until I added $APPNAME.app/Contents/Info.plist containing at least <plist><dict></dict></plist>

@phasstw

phasstw commented Aug 9, 2016

Copy link
Copy Markdown

I created an app, but it won't execute when I double-click on the bundle. It is just a #!/bin/sh script that has a echo "hello world" statement in it for testing purposes. Can someone give me some guidance on how to get my app to run from clicking on the bundle? Appify did not create a Info.plist file for me, maybe this is the issue? What needs to be in that file? Thanks!

@oubiwann

oubiwann commented Dec 9, 2016

Copy link
Copy Markdown

I forked this and added option-parsing, overridable icons file, and some other bits: https://gist.github.com/oubiwann/453744744da1141ccc542ff75b47e0cf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment