I want a script (bash/zsh/ruby/...) to run at boot time in OS X. What's the most simple way to do this, without messing with xml/plist files, and preferably not needing to make a meta AppleScript.
MacOS X uses Vixie cron, which has special meta tags for launching at reboot time. See the man page for the file format.
in your crontab would work. I'm not sure that this a better solution than launchd, you probably have more meta tools that look at launchd than cron.
In case you change your opinion:
<?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.superuser.245713</string> <key>ProgramArguments</key> <array> <string>/path/to/script.sh</string> </array> <key>UserName</key> <string>someuser</string> </dict> </plist>
/Library/LaunchAgents/ and make
root:wheel the owner/group.
There are also Login Hooks if you would prefer the script to run (as root) when a user logs in rather than when the machine is booted.