Skip to content

Instantly share code, notes, and snippets.

@josue
Created March 27, 2012 03:53
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save josue/2212352 to your computer and use it in GitHub Desktop.
Save josue/2212352 to your computer and use it in GitHub Desktop.
Hide or show the MAMP Pro dock icon.
#!/bin/bash
# Place this script in dir: /usr/bin
# Change permissions: sudo chmod +x /usr/bin/MAMP-DOCK-INVISIBLE
#
# Ensure the MAMP 'Info.plist' file has the following entry:
# <key>LSUIElement</key>
# <string dock-visible="1">NO</string>
#
# Usage:
# MAMP-DOCK-INVISIBLE 1 ... (hide dock icon)
# MAMP-DOCK-INVISIBLE 0 ... (show dock icon)
cd /Applications/MAMP\ PRO/MAMP\ PRO.app/Contents
echo
echo "... quiting MAMP PRO if active ..."
osascript -e 'quit app "MAMP PRO"'
echo
if [ $1 ] && [ "$1" -eq 1 ]; then
echo "... Hiding MAMP Pro from DOCK ..."
sed 's/<string dock-visible="1">NO<\/string>/<string dock-visible="1">YES<\/string>/g' Info.plist > Info.plist_new
else
echo "... Showing MAMP Pro in DOCK ..."
sed 's/<string dock-visible="1">YES<\/string>/<string dock-visible="1">NO<\/string>/g' Info.plist > Info.plist_new
fi
cat Info.plist_new > Info.plist
rm Info.plist_new
sleep 3
echo
echo "... Restarting MAMP Pro ..."
open ../
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment