When you turn on your Mac, various apps, add-ons (such as menu extras) and invisible background processes open by themselves. Usually these automated actions are exactly what you want, but you may sometimes see items running – either visibly or according to a listing in Activity Monitor (located in /Applications/Utilities) – that you don’t recall adding yourself. Where do they come from? Because such items can increase your Mac’s startup time (and may decrease its performance), you’ll want your machine to load only items that are useful to you. Here’s a quick primer on the various kinds of startup and login items and how to manage them.
Open the Users & Groups pane of System Preferences and click the Login Items tab, and you’ll see a list of apps (and even files and folders) that open every time you log in. (This list is different for each user account on your Mac.) More often than not, items appear in this list because apps added them to it. Most apps that do so ask you for permission first or offer an ‘Open at Login’ checkbox for you to check, but not all are so well-behaved. In any case, you can add an item to the list manually by clicking the plus sign (+) button, or remove an item by selecting it and clicking the minus sign (-) button.
Earlier versions of OS X relied on two folders – /Library/StartupItems and /System/Library/StartupItems – to hold items designated to load when you start your Mac. Apple now discourages the use of startup items, but some programs (mostly older apps) still use this mechanism. Normally your /System/Library/StartupItems folder should be empty; but if it contains something that you don’t use anymore, you can drag the unwanted item to the Trash to prevent it from loading automatically the next time you start your Mac.
Launch daemons and agents
Since OS X 10.4 Tiger, Apple has given developers another mechanism for launching items automatically: launch daemons and agents, controlled by the
launchd process. This approach provides more flexibility than either login items or startup items, but it is less transparent to users.
Behind the UNIX curtain. Instead of opening apps directly, launchd loads specially formatted .plist documents (XML preference files) that specify what should launch and under what circumstances. Sometimes these launch items run constantly in the background, sometimes they run at scheduled intervals and sometimes they run as needed – for example, in response to an event such as a change in a certain file or folder – and then quit.
The .plist files that launchd uses can occupy any of five folders, and their location determines when the items load and with what privileges:
- Items in /Library/LaunchDaemons and /System/Library/LaunchDaemons load when your Mac starts up, and run as the root user.
- Items in /Library/LaunchAgents and /System/Library/LaunchAgents load when any user logs in, and run as that user.
- Items in /Users/your-username/Library/LaunchAgents load only when that particular user logs in, and run as that user.
Keep your hands off some. Of those five folders, the two located in the /System folder (/System/Library/LaunchDaemons and /System/Library/LaunchAgents) are for components included as part of OS X, and you should resist the temptation to remove or alter them – they’re essential to keep your Mac running correctly.
Modify others as you like. As for the items in the other folders, feel free to browse through them and see what’s there. You can modify them – for instance, to disable them or to change how often they run – but before you do, you should understand a few things about how they work.
When you start your Mac or log in, the launch items in the relevant folders are loaded (that is, registered with the system) unless they have a Disabled flag set. Thereafter, their instructions will be carried out until you restart, even if you drag the launch item to the Trash. To see a list of all the currently loaded launch items on your Mac, open Terminal (in /Applications/Utilities) and type
launchctl list and then press Return.
If you want to stop a launch item from running without your having to restart, open Terminal and type
launchctl unload followed by a space and the full path to the launch item. (An easy way to add an item’s full path is to drag it to the Terminal window.) For example, take this code:
launchctl unload ~/Library/LaunchAgents/com.apple.FolderActions.enabled.plist
It unloads the launch agent that enables AppleScript folder actions. Repeat the command with
load instead of
unload to turn it back on.
Because most launch items run on a schedule or on demand, and because any of them could be disabled, the fact that something is present in one folder doesn’t necessarily mean the process it governs is currently running. To see what’s running at the moment, open Activity Monitor – but bear in mind that the name of a given process as shown in Activity Monitor might not resemble the name of the .plist file that tells OS X to launch it.
Try a helpful utility. For seeing what launch items do – or for enabling or disabling them, or for deleting them (except those in the /System folder) – without any messing around in Terminal, my favourite tool is Peter Borg’s US$10 Lingon X. There’s also a less expensive Lingon 3, but it can do its work only on the current user’s launch items, which makes it much less powerful. Lingon X provides a friendly graphical interface rather than an inscrutable XML file, although you’ll still need a little geek mojo to understand some of its capabilities.
Spontaneously reopening apps at startup
By default, when you restart your Mac, OS X 10.7 Lion and later reopen whatever applications and documents were open when you shut down. Whether this happens depends on the decision you make when you choose Restart or Shut Down from the Apple menu. In the dialogue box that appears, if the ‘Reopen windows when logging back in’ checkbox is selected, the items will reopen; if not, not. However, you must make this decision before you shut down or restart, and it’s all or nothing – if you want to open only specific items, you’ll have to uncheck this box and add the items that you want to open at login to Login Items.
Other explanations for mystery processes
Although the methods I’ve mentioned so far are the most common ways to launch apps automatically in OS X, they aren’t the only ones. If you have a mystery process that you can’t track down in any of these places, it could also be one of these:
A kernel extension. Kernel extensions, or kexts, live in /System/Library/Extensions and load at startup. They provide low-level features such as processing audio and adding support for peripherals. Most kexts on your Mac are part of OS X. The safest way to remove a third-party kext is to run an uninstaller provided by the developer.
A cron job. Cron is a Unix scheduling utility built into OS X. The easiest way to view and edit cron jobs without using Terminal is to download the free Cronnix utility by Sven A Schmidt.
A login script. Login scripts, like startup items, were used in older versions of OS X but are now deprecated.
by Joe Kissell, Macworld