Os x boot sequence : what is launched at startup of your Mac can be easily see :
“System Preferences” -> “Users & Groups” -> “Login Items”

However not everything is there.
#1 MAC Boot sequence
The sequence :
In the “power on“ step (as you probably figured out) EFI selects the right device to use : you can overwrite this pressing “options” key during startup. Btw after that BootROM, EFI, Boot Loader and Kernel aall of them have done their job the control passes to launchd process.
Launchd is in fact the first process that Kernel starts (PID is 1) and it starts the “user space” boot sequence
busycrack$ ps aux | grep launchd
root 1 0.0 0.1...0:07.95 /sbin/launchd
~/Library/LaunchAgents | Per-user agents provided by the user |
/Library/LaunchAgents | Per-user agents provided by the administrator |
/Library/LaunchDaemons | System-wide daemons provided by the administrator |
/System/Library/LaunchAgents | Per-user agents provided by Mac OS X |
/System/Library/LaunchDaemons | System wide daemons provided by MAC OS X |
For example in my home directory I have:
busycrack$ cd ~/Library/LaunchAgents && ls -ltra total 24 -rw-r--r--@ 1 busycrack staff 806 Jul 11 20:59 com.google.keystone.agent.plist -rw-r--r-- 1 busycrack staff 697 Jul 20 22:25 com.*****.XXXXX.YYYYYYY-1.0.plist drwx------@ 55 busycrack staff 1870 Jul 28 18:06 .. -rw-r--r-- 1 busycrack staff 606 Jul 28 18:40 de.metaquark.appfresh.plist
#a) list all with command “lauchctl list”
busycrack$ launchctl list ... - 0 de.metaquark.appfresh 581 - [0x0-0x4b04b].de.metaquark.appfresh - 0 com.apple.metadata.mdwrite ...
Where :
PID | Last Exit Status | Job Label |
581 | – | [0x0-0x4b04b].de.metaquark.appfres |
– | 0 | de.metaquark.appfresh |
#b) get details:
“lauchctl list de.metaquark.appfresh”
busycrack$ launchctl list de.metaquark.appfresh { "Label" = "de.metaquark.appfresh"; "LimitLoadToSessionType" = "Aqua"; "OnDemand" = true; "LastExitStatus" = 0; "TimeOut" = 30; "ProgramArguments" = ( "/Applications/AppFresh.app/Contents/Resources/AppFreshDaemon"; "/Applications/AppFresh.app"; ); };
#c) list all daemons not by apple :
“launchctl list | grep -v com.apple”
busycrack$ launchctl list | grep -v com.apple PID Status Label 216 - com.MadCatz.SmartTechnology - 97 com.adobe.CS5ServiceManager - 0 com.google.keystone.user.agent ...
#d) remove : “launchctl remove de.metaquark.appfresh”
#e) disable : “launchctl unload -w ~/Library/LaunchAgents/…”
How disable Deamon/Agent at startup?
launchctl unload -w ~/Library/LaunchAgents/com.google.keystone.agent.plist
less ~/Library/LaunchAgents/com.google.keystone.agent.plist <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <true/> <key>Label</key> ... ...
or in directory :
/private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist
Note peruser.501 : 501 (com.apple.launchd.peruser.501) is id of user :
busycrack$ id uid=501(busycrack) gid=20(staff) groups=20(staff)...
launchctl load -w ~/Library/LaunchAgents/com.google.keystone.agent.plist less /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist ... <key>com.google.keystone.user.agent</key> <dict> <key>Disabled</key> <false/> </dict>
launchctl unload -w ~/Library/LaunchAgents/com.google.keystone.agent.plist less /private/var/db/launchd.db/com.apple.launchd.peruser.501/overrides.plist ... <key>com.google.keystone.user.agent</key> <dict> <key>Disabled</key> <true/> </dict>
However for this and much more things :
- man launchd
- man launchctl
#2 Bonus
2.1) try command : sudo launchctl bstree -j
Customizing Login and Logout :
2.2) you can check present of login script with command : LoginHook
defaults read com.apple.loginwindow LoginHook
Script (if present) which is attached to user login… more details : http://support.apple.com/kb/HT2420
2.3) logout script : LogoutHook
defaults read com.apple.loginwindow LogoutHook
Script (if present) which is attached to user logout
#3 App GUI for lauchdctl
lingon : http://sourceforge.net/projects/lingon/files/latest/download

Add Comment