I recently ran into an issue during a full restore of a Time Machine backup where the Launchpad layout would not be restored, and instead returned to a default layout. If you're like me and have put a lot of effort in customizing the layout, it's a bummer having to do all the work again, especially since one would expect a full restore from Time Machine actually restores *everything* (but that's discussion for another thread, I guess).
At first, I assumed Time Machine didn't back up everything but, as it turns out, the files are present but not restored during a full restore operation. Luckily, there's a way recover this manually. You can also do this if for some reason Launchpad is corrupted and you want to go back to a previously working version from a Time Machine backup.
Recovery requires some basic knowledge of Terminal commands so if you're not very versatile in it, you may want to ask someone else for help.
The Launchpad database isn't directly accessible from a location within your user profile but instead relies on a location in the /private folder, a hidden folder structure on your system. Additionally, the path to the Launchpad layout database differs for each new user and system. There is an easy way to identify the location though by running this command:
echo /private$(getconf DARWIN_USER_DIR)com.apple.dock.launchpad/db/
This will display the location of the database files (which is in fact a set of SQLite3 database files). This same folder will also be present on your Time Machine backup. In order to restore the files, you simply can copy the files from the location on your Time Machine disk to its location on your Mac, overwriting the files during the copy:
cp -f /Volumes/TM Backup/timestamp.previous/Macintosh HD - Data/private$(getconf DARWIN_USER_DIR)com.apple.dock.launchpad/db/* /private$(getconf DARWIN_USER_DIR)com.apple.dock.launchpad/db/
In the example above, adjust the following to your own situation:
After copying, simply restart the Dock or log out and back in again: