MacOS – Adding The Delete Option To The Right Click Contextual Menu

macosshortcut-menu

In Windows it is possible to permanently delete a file or folder from the right click contextual menu. The right click contextual menu in OS X, does not by default give the option to delete a file or folder in this way, only the option to "Move to Trash", which means you then have to empty the trash manually in order to delete the file or folder.

Is it therefore possible to add this option to the contextual menu, to aid quick deletion ?

Best Answer

The simplest way is to create your own Service and call it whatever you want to name it.

I created a service simply called Delete Now and put it in my context menu like I have done here:

enter image description here

Make Your Own Delete Service

  1. Open up Automator (/Applications/Utilities/Automator) and create a new Service
    enter image description here
  2. At the top right pane, select files or folders in Finder
    enter image description here
  3. On the left most pane, select Utilities and drag the Run Shell Script option to the workflow
    enter image description here
  4. Change the "Pass input" field to arguments
    enter image description here
  5. Pase the following into the shell script body
for f in "$@"
do
rm -rf "$f"
done
afplay "/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/finder/empty trash.aif"  

6. Click File > Save on the menubar and give you service a name. Whatever you name it, is what it will be called

enter image description here

This will enable it immediately on your system. If you ever decide you don't want it, and need to replace this item, navigate to ~/Library/Services/ and you will see a list of folders called {servicename}.workflow. To remove the one you don't want, just delete it then in Terminal type

killall Finder

This will restart the Finder and remove it from the context menu straight away. Otherwise, it will clear up on next restart.


Add Keyboard Shortcut

To make a keyboard shortcut for the Service you created, follow these steps:

  1. From the Desktop, click the word Finder in the top left hand corner of the screen, then go to Services > Services Preferences enter image description here
  2. Scroll down the list on the right until you find the service you created by name. In this example, you can see Delete All that I made earlier. Highlight it, and click on add shortcut. enter image description here
  3. This will bring up a box. Make sure your mouse cursor is in there and depress the keys that you want to use to set the shortcut. In my example, I have used the combination Control+Shift+L. enter image description here
  4. Press Show All to save your settings.

Keyboard Symbols

To help anyone new to Apple keyboard symbols, here they are as follows:

^ = Control
= Shift
= Command
= Alt/Option