Skip to content

Instantly share code, notes, and snippets.

Forked from advorak/
Last active Apr 28, 2022
What would you like to do?
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
SCRIPT=`basename "$0"`
OSX_VERSION=`sw_vers -productVersion`
function usage {
cat <<EOF
$SCRIPT v${VERSION} for for Mac OS X -
$SCRIPT [options]
-h, --help Prints this help message, then exits
-s, --script Name of the script to 'appify' (required)
-n, --name Name of the application (default "$APPNAME")
-i, --icons Name of the icons file to use when creating the app
(defaults to $APPICONS)
-v, --version Prints the version of this script, then exits
Creates the simplest possible Mac app from a shell script.
Appify has one required parameter, the script to appify:
$SCRIPT --script
Note that you cannot rename appified apps. If you want to give your app
a custom name, use the '--name' option
$SCRIPT --script --name "Sweet"
Copyright (c) Thomas Aylott <>
Modified by Mathias Bynens <>
Modified by Andrew Dvorak <>
Rewritten by Duncan McGreggor <>
exit 1
function version {
echo "v${VERSION}"
exit 1
function error {
echo "ERROR: $1"
while :; do
case $1 in
-h | --help ) usage;;
-s | --script ) APPSCRIPT="$2"; shift ;;
-n | --name ) APPNAME="$2"; shift ;;
-i | --icons ) APPICONS="$2"; shift ;;
-v | --version ) version;;
-- ) shift; break ;;
* ) break ;;
if [ -z ${APPSCRIPT+nil} ]; then
error "the script to appify must be provided!"
if [ ! -f "$APPSCRIPT" ]; then
error "the can't find the script '$APPSCRIPT'"
if [ -a "$" ]; then
error "the bundle '$PWD/$' already exists"
mkdir -vp "$APPDIR"/{MacOS,Resources}
cp -v "$APPICONS" "$APPDIR/Resources/$APPNAME.icns"
chmod +x "$APPDIR/MacOS/$APPNAME"
cat <<EOF > "$APPDIR/Info.plist"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
echo "Application bundle created at '$PWD/$'"
Copy link

rogierlommers commented Jan 23, 2017

Thanks! One question though, I use the bash script below as a test, but where can I find the output of the script?

echo "$(date) - start backup" > /Users/me/Dropbox/backup.log
sleep 10
echo "$(date) - start backup" >> /Users/me/Dropbox/backup.log

Copy link

rogierlommers commented Jan 23, 2017

Or do I need to open a terminal window in the shell script?

Copy link

ghost commented Sep 1, 2017

@oubiwann, considered making this brewable? I like your version the best, because it includes the additional options like icon (which I was going to add as well prior to finding your fork).

brew install appify

I've never done it before, but it appears to be simple enough.

Copy link

pablonosh commented Jul 24, 2018

I get

"The application cannot be opened because it has an incorrect executable format." on High Sierra.

You can’t open the application “iPhone Bitrise Build” because it is not supported on this type of Mac.

Copy link

dlpigpen commented Nov 13, 2018

The icon does not update if I replace by new one?

Copy link

imanassypov commented Nov 28, 2019

What needs to be done for the new app to be disoverable by system_profiler, as in 'system_profiler SPApplicationsDataType' ?
Is there a way to 'register' the newly packaged app so it shows as 'installed'?

Copy link

oubiwann commented Nov 29, 2019

Yikes, I had no idea people were leaving comments here until today -- sorry, all!

I haven't used the script since 2016; I can give it a shot, and see if it still works.

@dlpigpen: usually running touch refreshes icons in Mac OS X ...

Copy link

b3z commented May 6, 2021

All Bundles I create on bigSure are not compatible it says.

Copy link

arioki1 commented May 20, 2021

Copy link

varenc commented Dec 28, 2021

This worked great for turning a script into a .app! But if you're doing this to deal with permission stuff, I'll note that the .app still isn't treated like one by macOS for security permission purposes. For example, if your script needs the Accessibility permission, macOS asks you to grant Accessibility permissions to bash (or zsh/sh/env/whatever), even though it's run from this .app. The heavier-weight Platypus app, linked above, addresses this for me so that the .app itself is what needs the permissions. Though I imagine for many this isn't important.

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