Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I write a startup script for Mac OS X?

I have created a jar file in java, and I want to make the application automatically start during system boot up. I found I have to write a shell script for that. What should be that shell script look like? Is there anything else I have to do to make an application automatically start at boot up?

like image 494
Sunil Kumar Sahoo Avatar asked Dec 07 '09 04:12

Sunil Kumar Sahoo


2 Answers

The preferred way to launch programs at OS X startup is to create a launchd daemon as explained here.

like image 112
Ned Deily Avatar answered Sep 20 '22 20:09

Ned Deily


In mac os x you can also just run "open program.jar" (or any folder, '-a' for native applications) and it will open detached from the terminal with any default environment settings that it would use if you just double clicked it.

You can also add a program (or the script) to the user's login items through System Preferences > Accounts > 'username' > Login items. This is completely point and click and doesn't require a shell script

like image 32
Mobs Avatar answered Sep 22 '22 20:09

Mobs