Remove services on OS X

I'm looking to remove some services completely, or at least from the list in the Keyboard preference pane. I've tried:

  1. Service Scrubber. It only removes services from the menu — something you've been able to do from System Preferences since 10.6.
  2. Removing files in ~/Library/Services/ and /Library/Services/. It's just that most third party apps don't put their services there.
  3. defaults delete /Applications/SomeApp.app/Contents/Info NSServices. It does remove the services from the list in System Preferences. But it also invalidates the bundle's code signature, and the changes can get reverted by updates.

I guess you'd just have to settle for the last option, and assign new signatures with codesign when needed. But is there any easier way?


#!/bin/sh

applist="Path Finder
Skim
TextWrangler"
IFS=$'\n'

for appname in $applist; do
    apppath=$(mdfind -onlyin /Applications/ -onlyin ~/Applications/ \
    -onlyin /Developer/Applications/ -onlyin /System/Library/CoreServices/ \
    'kMDItemKind == Application' | grep -i "/$appname.app$" | head -1)
    echo $apppath
    date=$(date '+%y%m%d%-H%M%S')
    cp "$apppath/Contents/Info.plist" "$apppath/Contents/Info-$date.plist"
    defaults delete "$apppath/Contents/Info" NSServices
    codesign -f -s - "$apppath"
done