How to Edit the Context Menu in macOS

When your Mac is brand new, the context menu is relatively short and sweet. And for the most part, it stays that way. But if you want to add or subtract to it, you have some limited flexibility to do so under macOS.

Unfortunately, the macOS context menu is not as flexible as Windows’ context menu. In Windows, pretty much any context menu item can be removed with a little registry hacking. As a more “locked down” operating system, macOS doesn’t offer an easy way to do that.

To edit the context menu the way Dropbox does, for example, you’ll need to hack the Finder application itself. That’s outside the scope of both our knowledge and this post, so we’ll stick to the ways that we can control what appears in the context menu.

The primary method for adding and removing context menu items from macOS’s context menu is through services. The services appear under the “Services” dropdown in the right-click menu at the bottom of the menu. macOS offers a GUI-based method here for adding and removing context menu items.

1. Open the System Preferences application from the Apple menu.

2. Click on the “Keyboard” preference pane.

3. Click the “Shortcuts” tab at the top of the window.

4. Select “Services” from the menu pane on the left.

5. This will show a list of all available services, sorted into some primary categories based on the input they take. Click on the checkboxes to toggle the visibility of the associated services.

6. Applications can add their own services here. You’ll find them based on what kind of item (file, folder, text) the context menu item takes as input. For example, if a context menu item appears when you right-click on selected text, you’ll find the service under the “Text” dropdown.

If you have a lot of services or use them frequently, it can be annoying to constantly have to wait for the dropdown to open. You can make all the services appear in the primary dropdown menu with a Terminal command.

1. Open Terminal at “Applications -> Utilities -> Terminal.app.”

2. Paste the following command into Terminal:

defaults write -g NSServicesMinimumItemCountForContextSubmenu -int 999

This command will edit the defaults for the minimum services required to create the Services submenu. The number at the end (999 in this example) sets the number of items required to create the Services submenu. If the number of services is less than this value, you won’t see the Services submenu. In this situation 999 is not meaningfully different from infinite, so you’ll always see every Services item.

3. Quit and relaunch Finder with the following Terminal command:

killall Finder

One submenu in the context menu, the “Open With” menu, has a tendency to get a little messy. You can deal with this in a few ways.

1. Remove duplicates from the “Open With” context menu

Sometimes the LauchServices database can get corrupted, causing massive duplication of the items in your “Open With” menu.

1. Run the Terminal command below to rebuild the LaunchServices database:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

2. Kill and restart finder with killall Finder. You might need to wait a few minutes before you restart it while LaunchServices rebuilds.

2. Manually ban apps from specific extensions

You can ban a specific application from associating with a specific file extension in the Open With menu. Only proceed if you feel confident editing plist files.

1. Right-click on the application whose entries you want to edit and click “Show Package Contents.”

2. Open the “Contents” folder.

3. Duplicate the “Info.plist” file and rename it something like “info-backup.plist” to create a backup file.

4. Open Info.plist in a text editor like TextEdit.

5. Search the document with Command + F for the following: “CFBundleTypeExtensions.”

6. This will show a lot of information. For a complex application like Photoshop, you’ll see one for every extension. Locate the “<string>…</string>” that contains the filetype you want to ban. For example, if I want to remove Photoshop from the Open With menu on PNG files, I need to look for “<string>png</string>” under CFBundleTypeExtensions.

7. Delete the relevant “<string>…</string>” entry. In this case we would delete “<string>png</string>.”

8. Open Terminal and run killall Finder to apply the changes.

While you don’t have as much control over the macOS context menu as you might in Windows, you can still make some customizations to the menu. You can add even more options to the Services menu by using macOS’ Automator application and creating Services.