Terminal Command Line Startup Items

Discussion in 'Mac OS X Lion (10.7)' started by CondorXIII, Nov 10, 2011.

  1. CondorXIII macrumors newbie

    Joined:
    Oct 28, 2011
    Location:
    Calgary, AB, Canada
    #1
    Hey guys, does anyone know how to add an item to startup items for a user through terminal. That way I can script it and push it to people that I administer at work. Thanks in advance if anyone has an idea. My Linux command line is a bit dusty.
     
  2. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #2
    Sure, since you're administering multiple systems and need to push things out to them, I assume you're running OS X Server. Startup Items are one of the options in Workgroup Manager.

    If you're managing multiple machines the hard way, check out login hooks.

    http://support.apple.com/kb/HT2420
     
  3. larkost macrumors 6502a

    Joined:
    Oct 13, 2007
    #3
    WorkgoupManager is on eway of doing this (and the most sophisitcated), but there are other ways:

    1) For person-by-person additions add it to ~/Library/com.apple.loginitems.plist. You could script adding this to that plist, but there are some diffuculties, namely that you need to get alias data, which is a pain in the neck. Note: copying it from one computer is not going to do what you want. The second difficulty (not as big a hurdle) is that you need to add this into the plist, and it is nested enough that you are not going to want to use the 'defaults' command, but rather need to use something more savy. I would use Python to do it.

    2) You could add this to the system-wide /Library/Preferences/loginwindow.plist dictionary, specifically as a path item in the AutoLaunchedApplicationDictionary array. This would work, and is also a GUI launcher, but it would happen for every single user. Same general issues with the plist apply as before, but you skip the Alias part.

    3) If this was a more command-line based thing, then you would want to use a launch-agent from /Library/LaunchAgents. Once you get the hang of the plist format, this is the best option for non-GUI things.
     

Share This Page