Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Remove items and/or shortcut keys from the Services menu System

My Services menu was starting to get a little bit cluttered with all the different services every application on my system wanted to offer me. The menu is generally unobtrusive but the problem was many of these apps wanted to offer services with hot-keys and by doing so were preventing me from using those hot-keys for my own purposes. I have dozens of tasks automated through the amazingly powerful and free Youpi Key. So, because these unwanted services were squatting on useful command keys, I wanted to remove them.

The services menu is created by the system every time you login. The system scans the info.plist or Info-macos.plist file of every application available for the NSServices item. To remove or alter a service, first locate the application that responds when the service menu item is selected. Control-click (or right-click) on the application's icon in the Finder (not in the dock) and select "Show Package Contents" from the contextual menu. A new folder window will appear; open the "Contents" folder that appears in this window.

In the current folder window should be an Info.plist or Info-macos.plist file. Open this file with the Property List Editor that came with the Developer Tools (if you have them installed) or a program like PrefEdit. You can even use a text editor such as TextEdit if you don't have any of these, but there is much greater chance of something going wrong if you do.

Within this file, find the item called NSServices. If you want to simply remove all services for this application, delete the NSServices item. If instead you want to disable the hotkey, but leave the service available, delete the NSKeyEquivalent item from within each NSService. Save your changes.

Repeat for every service you want to alter/remove. Logout. Login. Give the system about 30 seconds after the Finder appears to build the Services menu. It should now reflect your changes.

[robg adds: I haven't tested this yet, but I will soon, as my services menu is filled with things I seldom use. You may also wish to backup the files before you modify them, just in case you want the services back at some point in time.]

    •    
  • Currently 3.50 / 5
  You rated: 1 / 5 (6 votes cast)
 
[48,078 views]  

Remove items and/or shortcut keys from the Services menu | 18 comments | Create New Account
Click here to return to the 'Remove items and/or shortcut keys from the Services menu' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Remove items and/or shortcut keys from the Services menu
Authored by: smorr on Mar 06, '03 12:06:23PM

You would think that someone would be clever enough to write an app or haxie that would allow us to manage that menu in a way that it can dis/activate, reassign key equivalents or even activate different services according to which application is in the foreground or user is logged in.

For example, If I have my "open URL in Safari" set as command Option L in most apps, I may want to have it set as Command Option Control L in a specific app if it conflicts with another key command. I know this some what against consistency of user interface but it would be something consciously managed by the user in question.

What kind of talent would it take to create such an App?



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: hibou on Mar 06, '03 02:47:14PM

have you emailed Unsanity? sounds like their kind of project.



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: bluehz on Mar 07, '03 05:58:45PM

PLEASE don't get Unsanity involved. They will slap Application Enhancer (APE) on it then tell you its not APE when your machine becomes unstable. Gosh - what do all those "Thread 0 Crashed... APE" entries in the crash logs mean. Uhhhh... you're right Unsanity... APE is innocuous...

...sorry... you hit a tender spot bringing up Unsanity....



[ Reply to This | # ]
It's been done
Authored by: strider72 on Dec 06, '05 07:20:32AM
This has been done, though it seems the author made one beta and never went further. Nonetheless, I've used this and it seems to work well. Check out blacktree.com for the "Service Manager" preference pane.

[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: zo219 on Jul 24, '08 11:39:26PM

I guess it would take the talents of Peter Maurer of manytricks.com ... who wrote Service Scrubber.

And BTW, see his warning/explanation: as of 10.5, signed apps can't be "scrubbed." Be careful out there.



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: mervTormel on Mar 06, '03 02:45:36PM

rather than deleting these services and key equivalents, it would behoove you to just disable them by renaming them, e.g., NSServices -> xNSServices and NSKeyEquivalent -> xNSKeyEquivalent

this way, you maintain the integrity and context of the original package.

i suspect if some entity came up with a services manager package, they would/should code it this way.



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: heynnema on Mar 07, '03 12:04:50AM

No need to edit the files. Just move the apps out of the Applications
folder, or the user-specific Applications folder (if it exists). Log out, log
back in, and the services are gone!

I created an "Application" folder to hold those apps whose services I
don't want to appear in the menu.

The BIG benefit is that login times are SUPER FAST now, as it doesn't
have to scan all of these darn apps looking for services to add.



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: bluehz on Mar 07, '03 12:11:08AM

Sheeesh I have been looking for this tip for over a year! Thx.

One thing that I have that one of the software companies sent me when I was troubleshooting an issue for them - is a Service menu reloader. Very simple faceless app, launch it an voila - the menu is reset without logging out or restarting. I really don't know someone hasn't released something like this to the general public. I wrote the company how useful this little utility was an asked if they minded if I sent it to others and they never responded - now I have even forgotten who it was that sent it to me.



[ Reply to This | # ]
Services for apps not in Applications folder
Authored by: echo on Mar 07, '03 06:33:01AM

I have services working for apps that are not in the Applications folder.



[ Reply to This | # ]
Services for apps not in Applications folder
Authored by: bluehz on Mar 07, '03 07:57:55AM

I too have seen Services show up for apps not dir in /Applications. There appears to be no standard....



[ Reply to This | # ]
Services for apps not in Applications folder
Authored by: ReznorB5 on Apr 20, '03 04:25:09PM

They also work for apps in the /Applications/Utilities folder and
if you have anything in the ~/Applications or any Library
directory, plus the /Library/Core Services/ (such as the Finder).



[ Reply to This | # ]
Remove items from the Services menu
Authored by: zeorge on Sep 15, '03 09:00:14AM
the following shell script/command allows you to turn on/off the (NS) services for all apps. for each app you can turn on all its services on or off. you get rid of unused services and your clustered menu. and maybe faster logins (is it faster?)

all modifications of the info.plists in your apps are backed up in your apps. this means: you can move your apps around after modification or do whatever you want with them. you just have to regenerate the app-list with the script before newly enabling/disabling services (if you moved some nss apps).

copy the script below into a text file, save it as "/bin/nss" or somewhere else in your path. open terminal, type "chmod +x /bin/nss" and then "rehash". now you can start it just with "nss".

one last note: if you move a modified app out of the folders that are watched for (NS) services apps = those that are checked by the script to generate the app-list, then you can't reenable the services anymore because the script does not find the app. just move the app somewhere in the searched folders and regenerate the app-list. the searched folders are: /applications, /library, /system/library, yourhome/applications, yourhome/library

tested & used on jaguar, greetings zeorge

[robg adds: I removed the first script, as the second version below contains a bug correction.]

[ Reply to This | # ]
Remove items from the Services menu - BUG corrected
Authored by: zeorge on Sep 15, '03 09:24:42AM

OOPS! i found a little not dangerous, but annoying bug.
take this corrected version :

the following shell script/command allows you to turn on/off the (NS) services for all apps. for each app you can turn on all its services on or off. you get rid of unused services and your clustered menu. and maybe faster logins (is it faster?)

all modifications of the info.plists in your apps are backed up in your apps. this means: you can move your apps around after modification or do whatever you want with them. you just have to regenerate the app-list with the script before newly enabling/disabling services (if you moved some nss apps).

copy the script below into a text file, save it as "/bin/nss" or somewhere else in your path. open terminal, type "chmod +x /bin/nss" and then "rehash". now you can start it just with "nss".

one last note: if you move a modified app out of the folders that are watched for (NS) services apps = those that are checked by the script to generate the app-list, then you can't reenable the services anymore because the script does not find the app. just move the app somewhere in the searched folders and regenerate the app-list. the searched folders are: /applications, /library, /system/library, yourhome/applications, yourhome/library

tested & used on jaguar,
greetings zeorge

#!/bin/sh

get_basename() {
echo "$1" | awk '{ n=split(fp,field,"/"); printf("%s",field[n]) }' fp="$1"
}
get_dirname() {
echo "$1" | awk '{ n=split(fp,field,"/"); i=1; while(i<n) { printf("%s/",field[i]);i=i+1 } }' fp="$1"
}
get_line() {
sudo sed -n "${2}p" "$1"
}
get_numoflines() {
sudo cat $1 | sudo awk 'BEGIN { i=0 } { i=i+1 } END { printf("%s\n",i) }'
}
correct_encoding() {
sudo tr -s '\015\012' '\012' < "$1" | sudo tr '\015' '\012' >"$1"01
sudo mv -f "$1"01 "$1"
}
turn_nss_off() {
sudo cp -f "$1" "$1"_nssbak
sudo cat "$1" | sudo awk 'BEGIN { p=1;a=0 } {
if( match($0,"<key>NSServices</key>")>0 ) { p=0 }
if( p==0 && match($0,"<array>")>0 ) { a=a+1 }
if( p==0 && match($0,"</array>")>0 ) { a=a-1; if(a==0) { p=1 }; next }
if( p==1 ) { printf("%s\n",$0) } }' >"$tmpdir/${me}.encodebak"
sudo mv -f "$tmpdir/${me}.encodebak" "$1"
echo " NSServices OFF."
}
turn_nss_on() {
sudo mv -f "$1"_nssbak "$1"
echo " NSServices ON."
}

# MAIN

me=`get_basename "$0"`; version="0.2"
tmpdir="$HOME/Library/Preferences"

echo "$me, v$version - NSServices enabler/disabler - by zeorge 9-2003"
sudo -p " please authenticate : " -v
if [ $? -ne 0 ]; then echo "authentication error. abort!"; exit; fi

if [ -f "$tmpdir/${me}00.applist" ]; then
applistdate=`ls -l "$tmpdir/${me}00.applist" | awk '{ print $6" "$7" "$8 }'`
nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo "application list contains $nof applications, generated : $applistdate"
echo -n " * update application list ? "; read ans
else
echo "generating application list"
ans="y"
fi

if [ ${ans:=n} = "q" ]; then exit; fi
if [ ${ans:=n} = "y" ]; then
sudo -p " please authenticate : " -v
if [ $? -ne 0 ]; then echo "authentication error. abort!"; exit; fi
echo " searching in /Applications ..."
sudo find "/Applications" -name \*.app >"$tmpdir/${me}00.applist"
echo " searching in /System/Library ..."
sudo find "/System/Library" -name \*.app >>"$tmpdir/${me}00.applist"
echo " searching in /Library ..."
sudo find "/Library" -name \*.app >>"$tmpdir/${me}00.applist"
echo " searching in $HOME/Applictions ..."
sudo find "$HOME/Applications" -name \*.app >>"$tmpdir/${me}00.applist"
echo " searching in $HOME/Library ..."
sudo find "$HOME/Library" -name \*.app >>"$tmpdir/${me}00.applist"

nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo "found $nof applications"

echo "filtering out applications not offering NSServices..."
sudo -p " please authenticate : " -v
if [ $? -ne 0 ]; then echo "authentication error. abort!"; exit; fi
nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo -n " examining $nof applications ..."
n=0; counter=0
while [ $n -lt $nof ]
do
n=`expr $n + 1`
app=`get_line "$tmpdir/${me}00.applist" $n`
if [ ! -d "$app" ]; then continue; fi
cd "$app"/contents
if [ -f "info.plist_nssbak" ]; then
echo "$app" >> "$tmpdir/${me}01.applist"
counter=`expr $counter + 1`
echo -n "."
elif [ -f "info.plist" ]; then
nss=`sudo cat info.plist | sudo grep "<key>NSServices</key>"`
if [ -z "$nss" ]; then continue; fi
echo "$app" >> "$tmpdir/${me}01.applist"
counter=`expr $counter + 1`
echo -n "."
fi
done
echo
echo "found $counter applications"
mv -f "$tmpdir/${me}01.applist" "$tmpdir/${me}00.applist"

nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo "application list contains $nof applications offering NSServices"

echo -n " * filter out core services and system services ? "; read ans
if [ ${ans:=n} = "q" ]; then exit; fi
if [ ${ans:=n} = "y" ]; then
cat "$tmpdir/${me}00.applist" | grep -iv "^/System/Library/CoreServices/" > "$tmpdir/${me}01.applist"
cat "$tmpdir/${me}01.applist" | grep -iv "^/System/Library/Services/" > "$tmpdir/${me}02.applist"
mv -f "$tmpdir/${me}02.applist" "$tmpdir/${me}00.applist"
rm -f "$tmpdir/${me}01.applist"

nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo "application list contains $nof applications"
fi
fi

echo -n " * turn on/off individual NSServices ? "; read ans
if [ ${ans:=n} = "q" ]; then exit; fi
if [ ${ans:=n} = "y" ]; then
sudo -p " please authenticate : " -v
if [ $? -ne 0 ]; then echo "authentication error. abort!"; exit; fi
nof=`get_numoflines "$tmpdir/${me}00.applist"`
echo -n "processing $nof applications... "
echo "\"p\" full path, \"b\" back, \"y\" toggle, \"q\" quit"
n=0
while [ $n -lt $nof ]
do
n=`expr $n + 1`
app=`get_line "$tmpdir/${me}00.applist" $n`
if [ ! -d "$app" ]; then
echo $app
echo " cannot find app. try updating application list to find moved apps"
continue
fi
cd "$app"/contents
if [ ! -f "info.plist" ]; then continue; fi
if [ -f "info.plist_nssbak" ]; then
echo -n "$n * toggle NSServices ON for \"`get_basename "$app"`\" ? "; read ans
if [ ${ans:=n} = "q" ]; then exit; fi
if [ ${ans:=n} = "p" ]; then echo $app; n=`expr $n - 1`; continue; fi
if [ ${ans:=n} = "b" ]; then if [ $n -gt 0 ]; then n=`expr $n - 2`; fi; continue; fi
if [ ${ans:=n} = "y" ]; then turn_nss_on "info.plist"; fi
continue
fi
nss=`sudo cat "info.plist" | sudo grep "<key>NSServices</key>"`
if [ -z "$nss" ]; then continue; fi

echo -n "$n * toggle NSServices OFF for \"`get_basename "$app"`\" ? "; read ans
if [ ${ans:=n} = "q" ]; then exit; fi
if [ ${ans:=n} = "p" ]; then echo $app; n=`expr $n - 1`; continue; fi
if [ ${ans:=n} = "b" ]; then if [ $n -gt 0 ]; then n=`expr $n - 2`; fi; continue; fi
if [ ! ${ans:=n} = "y" ]; then continue; fi

if [ ! "$nss" = " <key>NSServices</key>" ]; then
echo " text encoding or xml code problem! fixing text encoding..."
sudo cp -f "info.plist" "info.plist_encodebak"
correct_encoding "info.plist"
nss=`sudo cat info.plist | sudo grep "<key>NSServices</key>"`
if [ ! "$nss" = " <key>NSServices</key>" ]; then
echo " fixing unsuccessful! returning app to original state. skipping app."
sudo cp -f "info.plist_encodebak" "info.plist"
sudo rm -f "info.plist_encodebak"
continue
fi
fi
turn_nss_off "info.plist"
done
fi



[ Reply to This | # ]
Remove items from the Services menu doesn't seem to work with Tiger
Authored by: philiph on Dec 20, '05 10:18:12PM
I just tried this script on Tiger and it didn't work. Every time I tried to remove a service in the script I get this:

6 * toggle NSServices OFF for "Quicksilver.app" ? y
 text encoding or xml code problem! fixing text encoding...
 fixing unsuccessful! returning app to original state. skipping app.
Here's the sh -x output:

+ echo -n '6 * toggle NSServices OFF for "Quicksilver.app" ? '
6 * toggle NSServices OFF for "Quicksilver.app" ? + read ans
y
+ '[' y = q ']'
+ '[' y = p ']'
+ '[' y = b ']'
+ '[' '!' y = y ']'
+ '[' '!' '     <key>NSServices</key>' = ' <key>NSServices</key>' ']'
+ echo ' text encoding or xml code problem! fixing text encoding...'
 text encoding or xml code problem! fixing text encoding...
+ sudo cp -f info.plist info.plist_encodebak
+ correct_encoding info.plist
+ sudo tr -s '


[ Reply to This | # ]
Remove items from the Services menu
Authored by: haumann on Dec 21, '05 07:35:21PM

> "the searched folders are: /applications, /library, /system/library, yourhome/applications, yourhome/library"

I think it's a little more involved than that. I've got Services menu items for applications that don't even reside on the start-up partition -- PixelNhance, for example, only an alias in the Applications folder.



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: jigu on Jan 31, '05 05:16:00PM

The mentioned "PrefEdit" doesn't seem to be able to open Info.plist files like it is mentioned. It doesn't even have a "open" command, and drag&drop doesn't work either. Who's in charge of these things?



[ Reply to This | # ]
Remove items and/or shortcut keys from the Services menu
Authored by: Guntis on Dec 21, '05 05:01:13PM
As mentioned in this MacWorld article, you can download ServiceManager from here and remove/restore services from the System Preferences. Cool...

---
I'm not really a Windows user...I just play one at work.

[ Reply to This | # ]

Service Scrubber
Authored by: sjk on Dec 22, '05 11:11:51PM
Even cooler (IMO) is Peter Maurer's new Service Scrubber.

[ Reply to This | # ]