How can I create a python script that runs when the computer boots? I know to get it to run on login I can turn it into an app and add it to a as a startup item in settings, but I need it to run once the computer boots.
How can I make a python script run when the computer is turned on?
I am running MacOS High Sierra 10.13.1 and Python 2.7.10
Best Answer
Use a plist like this:
Just make sure you replace the /path/to/script.py accordingly and then save it to your desktop. Then open up terminal and type
sudo chown root:wheel /path/to/plistfile
it will prompt for password type it in in and when you are typing it it won't give you any visual feedback then press enter. Then typesudo chmod 644 /path/to/.plistfile
. Then justsudo mv ...
the plist file in /Library/LaunchDaemons/ or /Library/LaunchAgents/ and finallysudo launchctl load ...
the plist and your script will run.And if you have any problem comment below and also tell me the OS your Mac is running.