Remove entries from finder's context menu?

You can actually remove native MacOS items from the context menu....but unfortunately, it doesn't appear you can remove the ones you indicated above. Regardless, if you want to take a look, head to

System Prefs > Keyboard > Keyboard Shortcuts > Services

and then uncheck the items you don't want on the menu.

enter image description here

It's unfortunate that you can't remove all of them. But it can at least help you get rid of some of the clutter.


  • I have worked out a solution for this that (so far) works for default Finder right menu context items such as Burn to disk and Burn "^1" to disc. This is exactly the goal of OPs request.

  • There's another breed of context menu bloat that comes from installing Services in the form of Applescript or executable plugins.

    Those are simple to get rid of. Whatever they're named, just search your disk for that string. i.e. Inject Potatos! service will ultimately be found in a file named Inject Potatos!.<something>. There may be some other shapes and sizes of them but they're the easy problem to solve and out of scope from the OPs post.

  • For non-english users: This solution is language agnostic. We take advantage of the localization functions that convert default strings + args into localized strings with expanded variables.

How it works explained with a series of wild guesses

I'm not sure about the Objective-C internals of it, but I suspect something similar to this is whats going on..

snprintf(str, 0, "", var1, var2, ..);

There's no format string (i.e. ""), so you always end up with str being zero length.

If the str is zero length, the localization resolver will walk backwards up the tree to find an ancestor format template that work. As long as you zero out all of the ancestors of that message class - it'll eventually exhaust templates and return a zero-length string to the localization requestor.

The context menu renderer recognizes that it's zero length and omits it from the context menu list items and you get a slimmer context menu.

IMPORTANT

  • If you don't know what you're doing - you could mess up Finder. Use this checklist to verify you've got the kung-fu.
  • Be comfortable using the shell
  • Know how to use a plaintext editor such as vim, nano, emacs, etc.
  • Always backups of any files you edit BEFORE you edit them.
  • Make ONE change at a time, kill Finder, verify everything looks good, goto 10. If you make a bunch of changes and it borks things up you'll just have to go revert all your changes anyway.
  • I know that NSString formatting is different than C, but if you're not an Objective-C guy, and need to think about it in terms of printf, the following too examples are basically the same for the purposes of this exercise.

    • Obj-C template: "Throw ^1 into the ^2"
    • printf template: "Throw %s into the %s", arg1, arg2.

    If you make a modification and after restarting Finder it does't seem to be taking affect - you might be modifying a localization string in some other area than the right-click context menu. Revert your change, restart Finder and try again. If you skip this step you may end up modifying something other than the context-menu and not realize it until days later.

  • Understand that this is basically a hack, it may not work the way you want or expect it to. For what it's worth I've been running with these changes (and more) for at least a couple weeks now and have experienced no ill effects.


Stock Finder Context Menu Example

First lets look at a 'before' image taken from the OP's post that shows us a typical default Finder context menu full of bloat.

Bloated Finder Context Menu

Terrible!

The majority of Apple devices don't even ship with DVD burners anymore, yet there's Burn "^1" to disc taking up valuable real estate.

Not to mention the equally useless Quick Look, Duplicate, Make Alias, Copy ^1, etc.


New Hotness Context Menu

New Hotness

Stripped down as far as I could get it. Bear in mind, if we were selecting a file we would have the default Open and Open with.. menu items.

You don't lose anything unless you omit it.

Things can be made fairly sparse if you wish.


Instructions

  • Find the $LANGUAGE.lproj file you're interested in. In my case I speak English.
  • cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj
  • run plutil -convert xml1 Localizable.strings, to convert Localizable.strings into a plaintext XML plist file
  • MAKE A BACKUP OF Localizable.strings. If you mess something up you'll want to be able to revert your changes.
  • Open Localizable.strings in a plaintext / code editor (vi, pico, emacs, jed, etc -- TextEdit.app cannot save *.txt files and should be avoided)

    Find the value you want to hide. In my case it was 'Burn "^1" to disk' which is key BC50_V2.

    <key>BN50_V1</key>
    <string>Burn to Disc…</string>
    <key>BN50_V2</key>
    <string>Burn “^1” to Disc…</string>
  • My first attempt was to remove the key-value-pair entirely, but this resulted in BC50_V1's string showing up in my menu.

    Some format strings will fall back to more generic templates if they exist. In that case you'll have to zero out multiple values.

    You can see this behavior with BC50_V2 which falls back to BC50_V1.

    Since I wanted to complete get rid of any Burn... menu entries, I had to zero out BC50_V1 as well.

    There are other key value pairs that had multiple fallbacks but they're usually pretty easy to identify as they'll have the same prefix BC50_ and numerically incrementing suffixes _V1, _V2, _V..

  • You can annotate your changes by keeping a copy of the original key/value pair XML fragment inside an XML comment.

    I make a copy of the fragment to change, comment out the old fragment with a description and make my modifications to the copy. That way I can easily revert and don't have to use version control or have multiple copies of the file.

<!-- OLD Burn.*to Disc... 

    <key>BN50_V1</key>
    <string>Burn to Disc…</string>
    <key>BN50_V2</key>
    <string>Burn “^1” to Disc…</string>

-->

<!-- NEW Burn.*to Disc -->
<key>BN50_V1</key>
<string></string>
<key>BN50_V2</key>
<string></string>
  • If you want to change a string instead of removing it entirely - you can do that too. Variables seem to be accessible using the form ^<number>. Then number represents the nth argument. If you were feeling especially pimpy you could modify Burn "^1" to Disc to Archive "^1" forever utilizing an optical disk!.
  • Save your modifications to disk
  • killall -HUP Finder to restart Finder
  • open . to open up a Finder window in your current working directory. Right click to open the context menu, verify everything looks good.
  • All done! There doesn't seem to be any penalty to keeping the Localization.strings file in the text plist format so you don't need to concern yourself about converting in and out of binary or text formats whenever you make changes.