Soheil
Soheil

Reputation: 795

How to run a sudo privilege command on start up in OSX

I have a python script which I'd like to run every time my machine boots. It requires sudo however. What's a simple solution to make my python script with sudo on startup?

Upvotes: 1

Views: 2747

Answers (2)

Parag Bafna
Parag Bafna

Reputation: 22930

You can use launchd.

launchd -- System wide and per-user daemon/agent manager

Add your property list file to the /Library/LaunchDaemons directory.

Have a look at Technical Note TN2083 Daemons and Agents

Upvotes: 0

Soheil
Soheil

Reputation: 795

For non-privileged startup scripts simply add your single line command to /etc/rc.local for commands that require sudo add it to /etc/rc.common.

Upvotes: 1

Related Questions