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

A script to manage system-wide services System
This shell script will allow you to turn on or off the system-wide services for all applications. For each application, you can turn all of its services on or off. By disabling unused services, you will have a much less cluttered menu, and maybe faster login (is it faster?). All modifications to the info.plist files in your applications are backed up in your applications. This means that you can move your applications around after modification, or do whatever you want with them -- you just have to regenerate the application list with the script before newly enabling or disabling services (if you moved some NSS applications).

Download the script (see Rob's note below) into a text file, save it as /bin/nss, or somewhere else in your path. Open the Terminal and type chmod +x /bin/nss, and then rehash. Now you can start the program by just typing 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, ~/Applications, and ~/Library.

[robg adds: This script appeared as a comment to an older hint about removing items from the services menu, but I felt this was a unique-enough solution that it merited publishing on its own. Due to the length of the script, I uploaded it to macosxhints as a separate Stuffed text file -- nss.sit [2kb]. Expand the archive and follow the directions in the "Download the script..." paragraph above.

When you first run the script, you'll be asked to authenticate, and then it searches for all installed apps, then digs out those with services. At that point, you can choose to skip the core services from the next step (ie you'll never want to disable the core services), and then you're offered the chance to enable or disable each application's services one at a time. Overall, this is a much nicer solution than hand-editing plist files ... now, if someone would just wrap it in a GUI :)...]
  • Currently 2.00 / 5
  You rated: 3 / 5 (4 votes cast)

A script to manage system-wide services | 14 comments | Create New Account
Click here to return to the 'A script to manage system-wide services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to manage system-wide services
Authored by: Hanji on Sep 20, '03 06:17:07PM
If you just download the file from the link, it appears that it has Mac line endings (\r), which will screw with bash. You need to replace them with \n somehow, such as by
perl -pi -e 's/\r/\n/;' nss
or with an editor like jEdit or (I believe) BBEdit.

[ Reply to This | # ]
A script to manage system-wide services
Authored by: Nostromo1965 on Sep 20, '03 08:09:19PM

I selected all of the text, did a Copy, then in terminal I did a 'pico -w' and pasted it in, and it worked fine.

[ Reply to This | # ]
A script to manage system-wide services
Authored by: sdt on Sep 21, '03 01:56:11PM

Same here. Saving it as a text file using TextEdit and then opening the file using pico or vi seems to cause the problem. A direct paste into pico or vi works fine.

[ Reply to This | # ]
A script to manage system-wide services
Authored by: wgscott on Sep 21, '03 11:21:46AM

You have to use backslash to escape the r and the n or else

you will only be replacing the letter r withthe letter n

perl -pi -e 's/\r/\n/g'

I make an alias called



alias mac2unix "perl -pi -e 's/\r/\n/g'"

for tcsh


alias mac2unix="perl -pi -e 's/\r/\n/g'"

for zsh, bash, etc

[ Reply to This | # ]
A script to manage system-wide services
Authored by: jonn8n on Sep 21, '03 02:13:58AM

A GUI for this has been around for a while:


[ Reply to This | # ]
Has anyone gotten this to work?
Authored by: wgscott on Sep 21, '03 12:03:19PM

Every time I tried to change something I received an error message.

[ Reply to This | # ]
Has anyone gotten this to work?
Authored by: sdt on Sep 21, '03 01:59:50PM

It has worked fine for me. Can't help wondering why /Applications/Utilities is left out of the application search path???

[ Reply to This | # ]
Has anyone gotten this to work?
Authored by: sdt on Sep 21, '03 03:06:26PM
I tell a lie. I haven't got it to work. On first run I answered 'no' to 'core services?' and 'no' to 'individual apps?' and assumed it would work when I had the time to go through them. However, like you say, each individual app produces the same error:

5 * toggle NSServices OFF for "" ? p
/usr/local/bin/nss: get_basename: command not found
5 * toggle NSServices OFF for "" ? y
text encoding or xml code problem! fixing text encoding... fixing unsuccessful! returning app to original state. skipping app.
/usr/local/bin/nss: get_basename: command not found

I can't even begin to help with troubleshooting. Just thought I'd back you up after claiming it worked before fully testing it!

[ Reply to This | # ]
Same error too.
Authored by: gxw on Sep 21, '03 04:04:00PM

I get the same xml error as above on the apps I tried to toggle.

[ Reply to This | # ]
I believe I found the problem
Authored by: jreese on Sep 21, '03 09:19:19PM

Line 157 of the script contains

if [ ! "$nss" = " <key>NSServices</key>" ]; then

I found that there were two spaces between the quotation mark and the "<key>" tag. When I changed the two spaces to a single tab character in BBedit, the script worked as advertised.

[ Reply to This | # ]
troubeshooting! mr. wolf :)
Authored by: zeorge on Sep 22, '03 05:45:24AM
hi, sorry to cause you the troubles ...

1. in the last paragraph there is this line: it is important that between the opening bracket (") and is only one character: a tab! this is the line:
if [ ! "$nss" = "[tab]NSServices" ]; then

2. the whole thing must be unix-textencoded! you can do this with a texteditor like bbedit or as described somewhere in this thread use perl -pi -e 's/\r/\n/g' /bin/nss. i ask rob to correct this in the download link so you maybe dont have to correct this anymore. check the correct encoding with cat /bin/nss, if you see only one line its wrongly mac encoded!

maybe better don't use textedit to copy/paste/save the script. download (save as) directy from the browser to the computer. this should work as soon rob corrected the download. (check the encoding)
or use pico in the terminal to copy/paste/save the script!

greetings, zeorge

[ Reply to This | # ]
The download file...
Authored by: robg on Sep 22, '03 07:14:48AM
If you copied and pasted into TextEdit, you'd get the line ending problem. To avoid it, use BBEdit in UNIX line ending mode, or just paste directly into a UNIX text editor like vi or pico or emacs.

However, there was a problem with the missing TAB character. I have now fixed that, and made a new download file: nss.sit [2kb] that fixes the issue. Just expand the archive, put it in the right directory, make it executable, type rehash, and you're good to go -- I tested with the downloaded file, and it worked perfectly.


[ Reply to This | # ]
Worth the wait...
Authored by: sdt on Sep 22, '03 02:44:27PM

Works like a dream now. Thanks for a v. handy script.

[ Reply to This | # ]
A script to manage system-wide services
Authored by: DMCrimson on Jul 21, '05 06:47:37AM

Ok, I've installed the services prefpane, but got fed up with it for various reasons - the padlock being greyed out, inability to use it on finder etc apps. So, I decided to try the fixed script from below, and now I've cleaned my services to those I need:) The system services are now in /System/Library/Services - speech service had to be turned off manually by tinkering the plist, the script was not able to find it (hehe, prolly should just edit the script to include a path or few more) No rebooting needed after tampering, just update the menu using the mentioned prefpane, and relaunch finder to see the effects. Thanks again:)

[ Reply to This | # ]