Fastest way to disable daemons gone wild; how to know if attempts to interrupt will break app?
Moscarda, friend:

These are good points, each, and I agree with your conclusion that the list of system daemons or services which are running after the operating system installation is rather excessive.  

Between performance and ease-of-operation I readily prefer performance.  Thus, I tend to reduce to bare minimum the list of services which are allowed to run.  I also expect that if something fails to work auto-magically, that I probably need to launch a particular system service which got disabled as a consequence of my preference for performance over ease-of-operation.

Apple has made disabling services rather elegant via launchd in the more recent versions of its operating system.  To a system administrator's dismay, however, Apple continues to allow the historic, deprecated means of launching services and therefore some third-party software still uses the likes of SystemStarter.  SystemStarter is a direct descendant of historic BSD rc (resource control) and System V init processes.  While being more modern than the historic UNIX parents it descends from, SystemStarter is still a far cry from the more evolved functionality and elegance of launchd. 

My procedure:


Preserve a copy of the original state of configuration by making a backup of relevant files.  

 mkdir /private/var/archive ; tar -czvf /private/var/archive/SERVICES_$(date '+%Y-%m-%d-%H:%M:%S').tar.gz /System/Library/StartupItems /System/Library/LaunchDaemons /System/Library/LaunchAgents /Library/StartupItems /Library/LaunchDaemons /Library/LaunchAgents ~/Library/StartupItems ~/Library/LaunchDaemons ~/Library/LaunchAgents 

Inspect what still relies on the deprecated StartupItems and disable anything relevant by removing its items from the ( ~/ | /Library/ | /System/Library/ ) StartupItems folder.


Please remember this: These paths ~/, /Library/, /System/Library/ are listed in order of their importance and therefore sensitivity to potential errors that might affect the ability of your machine to boot properly or behave normally.  Use caution, and when in doubt, recover from the archive the original file, replacing any edited files in error.  


Identify what is running via launchd:

 launchctl list | grep -v '^-' | sort -nr -k 1

Test system stability and needed functionality by stopping the services identified in step 3:

 launchctl stop [service name] ; launchctl remove [service name] 

Unload services that are able to be disabled in the list from step 4. 

 launchctl unload [service name]

Disable the startup of the items stopped in step 4 by editing the appropriate .plist file ( for info -- man launchd.plist ) and if already present, set the 'Disabled' key to true.  If this key is not already in the file, add it by adding the following lines to the first  block:

    &lt;key&gt;Disabled&lt;/key&gt;
         &lt;true/&gt;



The first five lines from a config file on my system illustrates this:

 &lt;?xml version="1.0" encoding="UTF-8"?&gt;
 &lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
 &lt;plist version="1.0"&gt;
 &lt;dict&gt;
     &lt;key&gt;Disabled&lt;/key&gt;
     &lt;true/&gt;
     &lt;key&gt;Label&lt;/key&gt;
     &lt;string&gt;com.apple.tftpd&lt;/string&gt;



Reboot the system.  Better to do it the gentle way, than to issue a launchctl reboot, unless you are prepared for the brutal user session tear down which may result in lost information, unpreserved states, inconsistent file states.  


I hope this helps.  

F.