How To Hide App Icons From OS X Launchpad With A Script
The Launchpad in OS X is great not just for launching apps, but also for keeping them organized. The folders you create in Launchpad aren’t real folders created in the Application folder, and that allows you to keep apps you frequently use grouped differently from the list of installed apps. The only problem with app icons in Launchpad is that you can only move them to a folder, and not hide them completely. This is pretty much like sweeping dirt under the rug; the app icons are still there, though hidden in a folder and just out of sight. The good thing is that you can remove app icons from Launchpad with a simple little script, and not worry about the app being deleted from your system.
To delete icons from Launchpad, you first need to open AppleScript Editor and paste the following script into it.
on open the_items my Lighten_LaunchPad(the_items) end open on Lighten_LaunchPad(the_items) repeat with the_item in the_items set the_item to the_item as alias --try tell application "Finder" set nameString to name of the_item set sost to (my get_the_name(nameString)) as string end tell display dialog "Are you sure you want to remove \"" & sost & "\" from the Launchpad? The app itself won't be deleted." try set my_command to "sqlite3 ~/Library/Application\\ Support/Dock/" & "*.db \"DELETE from apps WHERE title=" & (quoted form of sost) & ";\";osascript -e 'tell application \"Dock\" to quit'" do shell script my_command on error the error_message number the error_number activate if the error_number is not -128 then if the error_number is 1 then set the error_text to "Error: " & the error_number & ". " & "You probably have too many old versions of the LaunchPad database file." & return & return & " To fix that, move some old ones out of ~/Library/Application Support/Dock. You can safely move any file with a name that ends with \".db\" or \".db.backup\" except for the most recently modified one." & return & return & "Do you want me to open that folder for you?" display dialog the error_text buttons {"Yes, please open it.", "Cancel"} default button 1 if button returned of the result is "Yes, please open it." then do shell script "open" & space & quoted form of POSIX path of (path to application support folder from user domain) & "Dock" end if error number -128 else set the error_text to "Error: " & the error_number & ". " & the error_message display dialog the error_text buttons {"Cancel"} default button 1 end if else error number -128 end if end try end repeat display dialog "All done!" buttons {"OK"} default button 1 end Lighten_LaunchPad on get_the_name(nameString) tell AppleScript set olD to text item delimiters set text item delimiters to "." set reqItem to -1 if last item of nameString = "." then set reqItem to -2 set theName to text item reqItem of nameString --try set theNameNoExt to ((text items 1 through (reqItem - 1) of nameString) as string) set text item delimiters to olD return {theNameNoExt} end tell end get_the_name on run set the_items to ((choose file) as list) Lighten_LaunchPad(the_items) end run
Next, save the script as an app anywhere you like. Now launch this app and a Finder window will open. Select the app you want to remove from Launchpad, and confirm when it asks you if you really want to delete its icon. The Dock will now restart, and the app will be gone from Launchpad. Just repeat it for all the icons that you want to remove from Launchpad, and you should be done.
If you want to restore any app’s icon in Launchpad, you don’t need to rely on this script (or any other tool, for that matter); simply open your Applications Folder and drag & drop the app’s icon on to Launchpad.
Be warned that removing and adding icons like this will not keep their folder structure in the Launchpad intact. When you add back an app icon that was previously sorted in to a folder before you removed it, it will not restore to its old position and you will have to manually drop it into the folder of your choice again.
If you’re fine with having to install another app for this purpose, you might want to try out Launchpad-control.
[via Mac OS X Hints]
It’s a shame that Fatima didn’t reply with a fix to Michael Davies’ problem. This script was published by llee on MacOS Hints website the day before Ms Wahab uploaded it here (there’s a link to the MacOS Hints article at the end of hers). If you follow that original article, in the comments below it the original author has suggested a change to the script which I think fixes this problem.
I get an error when I try this
“Expected end of line, etc. but found “try”.”
Have I done something wrong?.