View Full Version : Creating a command that starts when OS X boots
Apr 15, 2008, 12:00 AM
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!!!
Apr 15, 2008, 01:30 AM
Probably someone can provide you with more details, but start by reading up on launchd (http://developer.apple.com/macosx/launchd.html), 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 (http://lingon.sourceforge.net/), which is a free GUI application to help you create and manage launchd processes.
Apr 15, 2008, 01:32 AM
you could use a cron.
@reboot userid /path/to/app
Apr 15, 2008, 01:35 AM
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?
Apr 15, 2008, 04:01 AM
Follow this guide (http://www.noendpress.com/vroman/shellscripting/index.php) 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.
Apr 15, 2008, 05:14 PM
Follow this guide (http://www.noendpress.com/vroman/shellscripting/index.php) 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.
Apr 15, 2008, 09:30 PM
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. (http://www.macdevcenter.com/pub/a/mac/2003/10/21/startup.html) 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!
Apr 16, 2008, 01:39 AM
Hey all thanks for the help... managed to get it done!!!