Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stakis

macrumors member
Original poster
Oct 25, 2007
94
0
Hey all,

I haven never done this before so I'd like some help

I'm looking to have Terminal load and run a command and the quit when OS X boots... kinda like a start up app..

is there any way this can be done?

please if you can give me a detailed instruction that would be great!!!

Thanks again!!!
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
Probably someone can provide you with more details, but start by reading up on launchd, which is what OS X uses to do such things. You might also be able to run an AppleScript, but I think all startup processes have to run with root privileges. Also check out Lingon, which is a free GUI application to help you create and manage launchd processes.
 

DoFoT9

macrumors P6
Jun 11, 2007
17,586
100
London, United Kingdom
out of curiosity...

that would only start once the user has logged in?? or can you put it at the OS level and it starts after the rest of the computer has loaded??

e.g. can you have it load while still at the login window?
 

Mac_Max

macrumors 6502
Mar 8, 2004
404
1
Follow this guide to make your shell script (shell referring to the terminal), and then use the Login Items section in the Accounts Preference Pane to start it at boot.
 

HiRez

macrumors 603
Jan 6, 2004
6,265
2,630
Western US
Follow this guide to make your shell script (shell referring to the terminal), and then use the Login Items section in the Accounts Preference Pane to start it at boot.
But that won't run the script at boot, only at login time, for a particular user (unless they added some option for this in Leopard I'm not aware of). The OP said they wanted to run it at boot time.
 

bloomberg

macrumors newbie
Sep 8, 2007
25
5
I'm a recent switcher so there may be a better (read faster) way. It takes a few steps to create a startup script under osx.
  • Create a directory under /Library/StartupItems/yourscript
  • Create a *.plist file for your script in yourscript dir that defines your script parameters
  • Create a startup script in yourscript dir (it may also stop & restart)
Read about the details here. As someone who uses linux I certainly appreciate why it's done this way. However, a simple helper script to generate the most common cases would be nice instead of copying and pasting every time. Good luck!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.