I didn’t realise how easy this was, but it is very easy to simulate a slow connection in Mac OS X, which will help with testing sites for users that don’t have the blazing fast connections that us developers tend to have.
Why would you want to do this? Well, the primary use case I have is when testing sites that are heavy on Javascript, for instance, testing that everything is loaded up when it needs to be and that the latency of the connection isn’t breaking anything.
So how do we do it? Simple:
In terminal.app run the following:
sudo ipfw pipe 1 config bw 30Kbit/s delay 350ms sudo ipfw add 1 pipe 1 src-port 80 sudo ipfw add 2 pipe 1 dst-port 80
This will set rules to limit all traffic on port 80 to 30Kbit/s with a latency of 350ms. Edit the commands to change the speed / ports as you require.
In order to undo this, simply run the following:
sudo ipfw delete 1 sudo ipfw delete 2
Simple when you know how
(Note that f you are using Safari to view the pages, you’ll need to use your Mac’s hostname or external IP address in the URL (for example, mymac.local rather than localhost).












There is a great GUI app called Entonnoir that helps with this as well.
http://tools.chocoflop.com/entonnoir_en.html
I use Charles for this…if you haven’t heard of it yet, you should check it out, it’s one of my “must-have” development tools: http://www.charlesproxy.com