Restrict the speed of a port OS X

If you do local web development, sometimes you need to check to see how fast your site works/downloads. As you're local to the site, it's very fast. This is where ipfw can help.

ipfw can be used to limit bandwith on specific ports:

sudo ipfw pipe 1 config bw 15KByte/s

creates a pipe that only allows up to 15KB/s to go through.

sudo ipfw add 1 pipe 1 src-port 80

will attach that pipe to the outgoing traffic on port 80, effectively limiting the outgoing traffic of the web server.

sudo ipfw delete 1

will remove the pipe from the port.