How to get a list of configured services on Mac OS X 10.5.x

There's a command called service in /sbin. The manpage will tell you that it can list all available services on the system and using the --test-if-configured-on option you can test whether a service is currently enabled or not.

So writing a simple one liner is a piece of cake:
for srv in $(service --list 2>&1); do service --test-if-configured-on ${srv} && echo ${srv}; done

Note: the 2>&1 redirection is needed, because service --list prints its result to stderr (don't ask me why).
This will list all the services that are configured and enabled on your Mac.

If you need the list of disabled services, then just change the && with an ||:
for srv in $(service --list 2>&1); do service --test-if-configured-on ${srv} || echo ${srv}; done

Syndicate content