The Problem with LaunchServices
Have you ever double-clicked a standard JPG image on your Mac, and instead of opening cleanly in the Preview app, it unexpectedly launches Adobe Photoshop or a random third-party image editor? Or perhaps you right-click a file, select “Open With,” and see a massive, cluttered list of applications, including duplicates of the same app or apps you uninstalled months ago?
This frustrating behavior is caused by corruption in the LaunchServices Database. LaunchServices is the underlying macOS framework that keeps track of every application installed on your system and exactly which file types (extensions like .pdf, .jpg, .docx) each app is capable of opening.
When you install, update, and uninstall apps over several years, this database can become tangled. The fastest and most permanent way to fix these incorrect file associations is to manually delete the corrupted database and force macOS to rebuild it from scratch using the Terminal.
Step-by-Step: Rebuilding the Database
Because the LaunchServices command is buried deep within the macOS system framework, the command is quite long. You do not need third-party maintenance apps like OnyX or CleanMyMac to do this; the native terminal command is perfectly safe.
Step 1: Open the Terminal
- Open the Terminal application (found in Applications > Utilities, or search for it via Spotlight).
Step 2: Execute the Rebuild Command
Copy the following command exactly as written. This command targets the lsregister tool, tells it to kill the current process (-kill), reset the database (-seed), and scan the entire system (-r) to find all valid applications in the standard directories.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
Press Enter.
Step 3: Wait for the Process to Finish
The terminal will not provide any progress bar. It will look like nothing is happening for anywhere from 10 seconds to 2 minutes, depending on how many applications you have installed and the speed of your Mac’s hard drive.
When the process is complete, the standard terminal prompt (e.g., user@MacBook-Pro ~ %) will reappear.
Step 4: Restart the Finder (or Reboot)
To ensure the macOS graphical interface recognizes the new, clean database, you must restart the Finder.
Type the following command in the Terminal and press Enter:
killall Finder
Your desktop icons and open Finder windows will briefly disappear and reappear. Alternatively, you can simply reboot your Mac.
What to Expect After the Rebuild
Once the database is rebuilt, your file associations will return to their factory defaults.
- Double-clicking a PDF will correctly open it in Preview.
- The “Open With” menu will be clean, showing only applications that are currently installed and actually capable of opening that specific file type.
- If you previously set custom default apps (e.g., you want all HTML files to open in VS Code instead of Safari), you will need to set those preferences again. (Right-click a file > Get Info > Open with > Change All).
Conclusion
A corrupted LaunchServices database is a common annoyance for long-time macOS users. By utilizing the hidden lsregister tool in the Terminal, you can instantly clear out years of messy file associations and restore the snappy, predictable file-opening behavior expected from a Mac.