How to run a
sudo on command line when a Mac startup?
Specifically, I'm trying to run the following line on Mountain Lion:
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
There are other questions about running command-line tools at startup (like this), but they do not address the issue of
sudo and the required admin permissions/password.
Other Questions & Answers discuss
launchd, but that seems to be for daemon processes that need to be watched and re-launched if crashed. In contrast, I am simply trying to do a one-off, run that one line once at startup.
If things have changed over the years, it would be nice to run a sudo at startup on both older versions of Mac OS X like Mountain Lion as well as newer like Yosemite/El Capitan.