Mac OS X Disable Unnecessary Services

How do I disable unnecessary services under Mac OS X to secure my Mac OS X based desktop / server / laptop?

Mac OS X use the following directories to start various services (quoting from the man page):

ADVERTISEMENTS

  1. /System/Library/LaunchDaemons/ – System-wide daemons provided by Mac OS X
  2. /System/Library/LaunchAgents/ – Per-user agents provided by Mac OS X.
  3. ~/Library/LaunchAgents/ – Per-user agents provided by the user.
  4. /Library/LaunchAgents/ – Per-user agents provided by the administrator.
  5. /Library/LaunchDaemons/ – System-wide daemons provided by the administrator.

launchd manages processes, both for the system as a whole and for individual users using .plist files. Open the terminal and type the following commands to view directory files:

cd /System/Library/LaunchDaemons/
ls -l
ls -l | less

OR

cd /System/Library/LaunchAgents/
ls -l
ls -l | less

How Do I Disable Unnecessary Services?

You need to use the launchctl command as follows:

sudo launchctl unload -w /path/to/.plist/file
sudo launchctl unload -w /System/Library/LaunchDaemons/file.plist

In this example, you are disabling the Bonjour service, enter:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponderHelper.plist

References:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
5 comments… add one
  • Shaun Dec 26, 2009 @ 12:12

    If you don’t fancy using the shell then there’s a GUI tool called Lingon…

    http://sourceforge.net/projects/lingon/files/

  • JThreads Jan 14, 2010 @ 13:17

    How cannot like a shell if you’re visiting this site ;)

  • Mark Feb 12, 2012 @ 1:46

    If you disable Bonjour on a Macbook Pro running Snow Leopard, wireless internet dies you will have to remember what you just did in the terminal, and undo undo it to restore network access.

  • Roj Blake Mar 13, 2013 @ 19:47

    Plenty of sites telling ‘how’ to disable services/daemons on OS X, but really not found one telling us ‘which’ ones to disable, some are obvious, most are not :(

  • Linda Holmes-Rubin Jun 29, 2013 @ 17:27

    I am looking for a way to get rid of Office365 service. I am not at all technical, thats why I got a Mac. I never asked for this service, it just appeared after an update. It slows everything down. For a while it seemed to go away, again after an update, but after the most recent update, its back and slowing everything to a crawl. I am running Office for Mac 2011 with automatic updates and Mac OS 10.7.5. Help! I have tried moving it to trash, but get a message that I can’t trash it because its running. But I can figure out how to close it to trash it.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.