I have a Python program that writes to the /etc/hosts file. It works correctly manually entered using the sudo command. I want it to open automatically. I can load it into sudo launchctl but it returns PID - Status 1.
How do I fix this?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
PID - Status 1 means that the process doesn't have enough privileges to access some files (presumably /etc/hosts). To be able to execute script as root, you need to move the loader to
~/Library/LaunchAgents/ are run as current user so they don't have root rights).