Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 89 lines (63 sloc) 2.73 KB
#!/usr/bin/env bash
Appify="$(basename "$0")"
if [ ! "$1" -o "$1" = "-h" -o "$1" = "--help" ]; then cat <<EOF
Appify v5 for Mac OS X
Creates the simplest possible Mac OS X app from a shell script.
Takes a shell script as its first argument:
$Appify path/to/my-script
If you want to give your app a custom name, use the second argument:
$Appify my-demo "This is my awesome DEMO"
Once your app is created, $Appify will tell you the path to your Info.plist.
You should customize the Bundle Identifier and Get Info String at least.
MIT License
Copyright © 2010-2011 Thomas Aylott <>
Copyright © 2011 Mathias Bynens <>
Copyright © 2011 Sencha Labs Foundation
exit; fi
# Options
appify_FILE="$(basename $appify_SRC)"
appify_NAME="${2:-$(echo "$appify_FILE"| sed -E 's/\.[a-z]{2,4}$//' )}"
# Create the bundle
if [[ -a "$appify_NAME.appify" ]]; then
echo "$PWD/$appify_NAME.appify already exists :(" 1>&2
exit 1
mkdir -p "$appify_ROOT"
# Copy the source into the bundle as the CFBundleExecutable
if [ -f "$appify_SRC" ]; then
cp "$appify_SRC" "$appify_ROOT/$appify_FILE"
echo "Copied $appify_ROOT/$appify_FILE" 1>&2
# Create a new blank CFBundleExecutable
cat <<-EOF > "$appify_ROOT/$appify_FILE"
#!/usr/bin/env bash
echo "This ('\$0') is a blank appified script." 1>&2
exit 1
echo "Created blank '$appify_ROOT/$appify_FILE' be sure to edit this file to make it do things and stuff" 1>&2
chmod +x "$appify_ROOT/$appify_FILE"
# Create the Info.plist
cat <<-EOF > "$appify_INFO"
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" ""><plist version="1.0"><dict><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
<key>CFBundleName</key> <string>$appify_NAME</string>
<key>CFBundleExecutable</key> <string>$appify_FILE</string>
<key>CFBundleIdentifier</key> <string>appified.$USER.$appify_FILE</string>
<key>CFBundleVersion</key> <string>0.1</string>
<key>CFBundleGetInfoString</key> <string>0.1 appified by $USER at `date`</string>
<key>CFBundleShortVersionString</key> <string>0.1</string>
# Appify!
if [[ -a "$" ]]; then
echo "$PWD/$ already exists :(" 1>&2
exit 1
mv "$appify_NAME.appify" "$"
# Success!
echo "Be sure to customize your $appify_INFO" 1>&2
echo "$PWD/$"