I've tried everything and can't seem to get my script to run at startup. Modifying the .bashrc, .bash_profile, etc that route got me no where. Then I tried cron jobs, no luck. Then I've been pulling my hair trying to use the launchd function. I've made a launch daemon, which is allegedly the root functions, but that's no luck either. As a last try, I even tried Automator with no luck.
The file I want to run as root is: "/Users/CURRENT_USER/Dev/my_script.sh"
Here is what I have in my LaunchDaemons folder:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.startup.script</string>
<key>LaunchOnlyOnce</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/Users/CURRENT_USER/Dev/my_script.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>