15

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?

5
  • Ah, the beauty of OS X complicating things that should be simple.
    – cregox
    Mar 25, 2011 at 18:09
  • Which version of OS X are you running? The internals of OS X do tend to change quite drastically between major versions.
    – Majenko
    Mar 27, 2011 at 19:23
  • 5
    @Cawas: removing services is simple: you go to the list in System Preferences and uncheck them. What Lri wants to do, for some reason, is to remove them and making them impossible to restore. Why should it be easy to break stuff?
    – LaC
    Mar 28, 2011 at 23:40
  • @LaC it's probably a matter of taste in this case. In my case I wanted good old Expose. but let me reverse your question: it is simple to add the service to that list - why shouldn't it be simple to remove it completely and keep it clean if the admin so wish?
    – cregox
    Mar 28, 2011 at 23:52
  • AFAICT, it's just as simple. You add a service by putting it into Library/Services or installing an application that provides it. You remove a service by removing it from Library/Services or removing the application that provides it.
    – LaC
    Mar 28, 2011 at 23:58

1 Answer 1

3
#!/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
1
  • Any particular Certificate Type in step 2?
    – Daniel Beck
    Jun 2, 2011 at 18:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .