How do I restart, say for example my httpd or afpd, running any Mac OS X >= 10.5 (Leopard-), without having to use the GUI and go to System Preferences -> Sharing and unchecking/checking "Web Sharing"?
I'm looking for the canonical equivalent to Debian's invoke-rc.d apache2 restart
.
EDIT: The question is about launchd controlled services in general, not specifically Apache (-which was simply an example).
Best Answer
launchctl(8) is your friend. Just keep in mind that some of the services (sshd for example) are disabled in the configuration file so you will need to use the
-w
switch when loading them. Here is a sshd example:You can stop the service using the
unload
subcommand.To list the services, as you might have already guessed use the 'list' subcommand ;)