Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

There are some processes that are launched upon a login, how to get a list of these processes?
I want to prevent some processes from being launched automatically.

share|improve this question
    
For the prevention part of your question: How can I control (start/stop) applications and services that start up after reboot? –  Graham Perrin Feb 2 '13 at 21:15
add comment

2 Answers 2

up vote 2 down vote accepted

launchd and the Login Items pane of Accounts preferences are the two places that normally start a process when you log in.

If you don't see the item in System Preferences -> Accounts -> specific account -> Login Items then you will have to look into launchd.

Basically the LaunchAgents and LaunchDaemons folders in ~/Library

Lastly, if they are not there, then it's a system level launchd task that you might want to use launchctl to show or look in /Library instead of the user level library.

Most people just have to manage the preference pane. Here is a snap of mine showing the Activity Monitor selected and ready to be deleted if I press the button. enter image description here

share|improve this answer
    
System Preferences -> Accounts -> specific account -> Login works but how to disable a process? –  Chiron Jun 18 '11 at 20:20
    
If you are the user then just delete from this preferences pane - if for another user then can't if they can run it at another time - if they can run they can choose to run on login –  Mark Jun 18 '11 at 21:45
    
I'll add a picture to show the command for deleting an item if it's found in the Login Items preference pane. –  bmike Jun 18 '11 at 23:31
    
Plus: the lesser used, but still valid, Startup Items directories. Please see the linked question. –  Graham Perrin Feb 2 '13 at 21:18
add comment

You need to investigate launchctl(1) because there are a couple of contexts you will need to account for .

The easiest way is to look at the plist files in:

/System/Library/LaunchDaemons # System Context. Faceless. root lives here. /System/Library/LaunchAgents # Loginwindow, or Aqua, where you live, context /Library/LaunchDaemons /Library/LaunchAgents ~/Library/LaunchDaemons ~/Library/LaunchAgents

In the file you will see the default state of that daemon or agent. That is a sure way to tell if it is running at boot.

I mention the above degrading, foolish and time consuming method, because it is good to see all the stuff running. They claim the resources used are low for a loaded yet dormant daemon, but since 95%+ of them are set to RunOnDemand... to me that's running.

Don't actually do that for real though. There is a much easier way.

Remember

When you log in and open Terminal/iTerm, you are in Aqua context.

Loginwindow context is when you see the login window, unsurprisingly, and a ton of things run off that.

If you

sudo zsh  # why not be comfortable?

or some other method to get a root shell, the root user will be in System context, which is the context that all the daemons in /System/Library/LaunchDaemons run in.

I mention all this because the tool provided:

man 1 launchctl

has a verb,

launchctl list

which you might think from the man page, lists all the running services. You might feel it plausible, to switch to root, to get a higher level view of what runs when you login.

Sadly, each user sees his own context.

launchctl managername 

will tell you what it is.

For root, its System. From my nifty hidden admin user, it's Background, which is the same thing you get by typing

>console

into the username box for login

You can use the verb

launchctl bslist  

Which tells you what services are active, for you. It's different for _spotlight, for the hidden admin, for root, for macports etc.

Answer

The command to see the whole tree, is

sudo launchctl bstree [-j]

whatever you see when you run that after booting is what is running system wide. For your identity:

launchctl bslist 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.