How to remap delete and shift+delete keys to delete and permanently delete a file in Mac OS X Lion? I would like to delete and permanently delete a file in finder using del and shift+delete (windows style).

Is there any way to remap this in OS X lion?
If you want to delete files immediately, you can copy the files, open Terminal or iTerm, type rm -r ‌ and press ⌘V.

If you want to delete the files securely so that they cannot be recovered with an application like DiskWarrior or DataRescue, you can use srm -srf. srm uses the 35-pass Gutmann algorithm by default, but -s only overwrites files with a single pass of random data.

You could also create a service like this:



osascript -e 'on run argv
    set text item delimiters to linefeed
    tell application "Finder"
        display dialog "Delete the following files immediately?" &amp; linefeed &amp; linefeed &amp; text items of argv
    end tell
end run' "$@"
[[ $? != 0 ]] &amp;&amp; exit 0
rm -rf "$@"


I didn't use an Ask for Confirmation action, because it can't be used to display the paths specified as arguments, and the dialogs shown by it don't get keyboard focus.

The service cannot be used to delete a file if deleting it would require superuser privileges.

You can give the service a keyboard shortcut from System Preferences > Keyboard > Keyboard Shortcuts > Services. The shortcut recorders don't allow entering ⇧⌦ as a keyboard shortcut, but you can first give the service some temporary shortcut, then close the System Preferences window, then run something like f=~/Library/Preferences/pbs.plist; plutil -convert xml1 $f; open -e $f, and then change the key equivalent to $&amp;#x007F;:

&lt;key&gt;(null) - Delete Immediately - runWorkflowAsService&lt;/key&gt;
&lt;dict&gt;
    &lt;key&gt;key_equivalent&lt;/key&gt;
    &lt;string&gt;$&amp;#xU007F;&lt;/string&gt;
&lt;/dict&gt;


$&amp;#x007F; is ⇧⌦ (where ⌦ is Mac forward delete / Windows delete). ⇧⌫ would be $&amp;#x0008; (where ⌫ is Mac delete / Windows backspace). The format used for the shortcut strings is described in http://lri.me/keybindings.html.



As for making ⌦ (Mac forward delete / Windows delete) move files to the trash, you can modify Finder's property list:

defaults write com.apple.finder NSUserKeyEquivalents -dict 'Move to Trash' '\U007F'
killall Finder


However that also makes pressing ⌦ move a file to the trash when you are renaming a file.