Fixing Duplicate Icons in OSX Launchpad

I know, a little off-topic for a mostly SharePoint/.NET blog, but after a recent upgrade I found I had duplicate iPhoto icons in Launchpad. That frustrated me. I did a bit of Googling, and found others had the same problem, and were suggesting deleting the database that stores the Launchpad’s details. When the Dock was reloaded, it would recreate that database. Unfortunately, it would also lose the layout of all your folders and icons.

“Delete the database”, I thought, “It’s a database, how hard can it be to fix that?”

So I set out to fix the database without deleting it, and losing all my folders…

The database that launchpad uses is a sqlite database, so I opened Terminal, and opened the database:

andy$ sqlite3 ~/Library/Application Support/Dock/*.db

This command tells the terminal to open a sqlite session, connecting to any database (and there only is one) inside the Library > Application Support > Dock folder.

Next, I wanted to query the ‘apps’ table to find any called ‘iPhoto’ (I’m skipping over how I found there was an apps table – but see this blog post – and that it had a ‘title’ column)

sqlite> select * from apps where title="iPhoto";
18|iPhoto|com.apple.iPhoto||8|370119271.0|bookx
146|iPhoto|com.apple.iPhoto||8|370125850.0|book?

Hmm. Two rows returned. The | character separates the different columns, and the penultimate column – the long number – is the modified date. Therefore, I assumed that row ID 18 with the lower (earlier) modified date is actually the old icon. It was this one I wanted to delete. I ran a select to check I was only getting it, and then deleted it.

sqlite> select * from apps where title="iPhoto" and item_id=18;
18|iPhoto|com.apple.iPhoto||8|370119271.0|bookx

sqlite> delete from apps where title="iPhoto" and item_id=18;

A quick check showed one remaining iPhoto entry:

sqlite> select * from apps where title="iPhoto";
146|iPhoto|com.apple.iPhoto||8|370125850.0|book?

Finally, I ran the command

killall Dock

This is a bit terrifying – it closes the process supporting the Dock – but like Explorer in Windows, this restarts automatically, and when it does it loads the newly modified database file – without the second iPhoto icon.

Problem solved, without having to reorganise all my icons.

Advertisements
Fixing Duplicate Icons in OSX Launchpad

2 thoughts on “Fixing Duplicate Icons in OSX Launchpad

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s