works on Lion and Maverick
Step 1: View current firewall rules.
sudo ipfw show
Step 2: Add port forwarding rule (80 to 8080)
sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in
If you want to remove your firewall rules run:
sudo ipfw flush
Creds:
To Make Changes permanent
Persistence:
put your rules into a file :
/etc/ipfw.conf
add at the very top of your file
flush
Ensure that there are not leading or trailing whitespaces in any line.
add to ~/Library/LaunchAgents/com.yourdomain.ipfw.plist :
<?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.yourdomain.ipfw</string> <key>Program</key> <string>/sbin/ipfw</string> <key>ProgramArguments</key> <array> <string>/sbin/ipfw</string> <string>-q</string> <string>/etc/ipfw.conf</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
Either reboot, or
launchctl load -w ~/Library/LaunchAgents/com.yourdomain.ipfw.plist
the first time.
After that it is
launchctl load com.yourdomain.ipfw
http://serverfault.com/questions/183542/how-to-permanently-redirect-port-80-to-8080-on-os-x
sudo chmod 644 ~/Library/LaunchAgents/com.yourdomain.ipfw.plist
sudo chown root ~/Library/LaunchAgents/com.yourdomain.ipfw.plist
If any issues occur in console then try this thread
launchctl: Dubious ownership on file (skipping): /System/Library/LaunchAgents/com.yourdomain.ipfw.plist