Over months of upgrading applications, installing software updates, and migrating data across macOS installations, the Finder’s contextual Open With menu frequently becomes cluttered with annoying glitches. Users often see identical duplicate applications (e.g. multiple entries of “TextEdit.app” or “Preview.app”), references to deleted applications on external drives, or unassigned document icons displaying generic blank paper sheets.
These issues stem from corruption or stale indexing within the macOS Launch Services database—the core system registry that tracks Uniform Type Identifiers (UTIs), file extensions, and application bundle associations. While macOS does not provide a graphical switch to clean this database, Apple bundles a native command-line utility inside the CoreServices framework: lsregister. This guide explains how to locate, run, and automate lsregister to restore clean file associations.
Locating the lsregister Binary
Because lsregister is an internal framework utility rather than a standard user command, it does not reside in standard $PATH directories such as /usr/bin. It is stored deep within the macOS System framework directory:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister
To avoid typing this long directory path during maintenance, you can reference it directly or assign an alias in your shell profile.
Command Syntax and Maintenance Flags
The standard syntax for rebuilding Launch Services associations with lsregister is:
lsregister [-kill] [-seed] [-r] [-f] [-v] [-apps domain]
Essential Flag Breakdown
-kill: Clears the existing Launch Services database completely prior to rescanning.-seed: Re-populates the database using default system seed configurations for built-in Apple apps.-r: Recursively scans application directories to register installed app bundles.-f: Forces registration even if the application bundle appears unchanged.-v: Verbose mode; displays each application path as it is indexed.-apps domain: Specifies directory domains to scan (e.g.ufor user,sfor system,lfor local).
Step-by-Step Procedure to Reset Launch Services
1. Execute the Rebuild Command
Open Terminal and run the comprehensive rebuild sequence:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
The command executes quietly in the background for 10 to 30 seconds as it scans /Applications, /System/Applications, and user application libraries.
2. Restart the Finder and Dock
To force the macOS graphical shell to drop cached contextual menus and read the freshly generated database, restart Finder and Dock:
killall Finder
killall Dock
3. Verify Contextual Menus
Right-click any PDF, image, or document file in Finder and expand the Open With menu. Duplicate application listings and ghost entries pointing to uninstalled applications will be eliminated, and default app associations will reflect current disk contents.
Targeted Registration for Single Applications
If a newly installed application does not appear in Open With menus or fails to register its supported file extensions, register that specific application bundle directly without wiping the entire database:
# Register a specific third-party application
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/Visual\ Studio\ Code.app
Creating a Permanent Terminal Alias
To make Launch Services maintenance easily accessible in the future, add a shortcut alias to your ~/.zshrc file:
echo "alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder'" >> ~/.zshrc
source ~/.zshrc
Now, typing fixopenwith in Terminal will instantly reset the database and reload Finder in a single step.
Launch Services Troubleshooting Advice
- Temporary Default Resets: Resetting the Launch Services database clears custom “Always Open With” overrides for specific individual files, resetting them to the global system default handler for that file extension.
- Time Machine Volumes: If external backup drives are connected during the scan,
lsregistermight index older application versions stored on the backup volume. Unmount Time Machine and external backup drives before executing the command to prevent backup apps from appearing in menus.