How can I run terminal commands on startup or login? On FreeBSD I believe you can do this using rc.d - is there an equivalent for the Mac? I know how to set up Login Items, but these only work for GUI applications, and there must be an elegant way to make terminal commands run without wrapping them in a GUI executable? As clarified below, I sometimes need to sudo these commands.
Tell me more
×
Ask Different is a question and answer site for
power users of Apple hardware and software. It's 100% free, no registration required.
|
|
OSX uses launchd to start Unix scripts and executables at boot or login. New tasks are added via launchctl to update a plist An easier way of doing this is to use the app Lingon now available on the Mac App Store. |
|||
|
Use Apple Script. The script would be like this:
Create an application that uses this script. This application can be added to the login items. I've explained in detail how to do this here. Executing commands in Apple Script as admin Password prompt at runtime:
Password saved within the script:
|
|||||
|