A simple macOS utility to simulate different network conditions (e.g. 3G, 4G, edge, wifi) for all TCP and UDP traffic. Useful for testing how your app behaves under degraded or limited network environments.
- Simulate bandwidth throttling, latency, and packet loss
- Affects all TCP and UDP traffic (including WebRTC)
- Easy reset to return to normal
- macOS-native using
pfctlanddnctl
- macOS with
pfctlanddnctl(usually built-in) - Root access (
sudo) - Bash shell (
bash >= 3)
# Make the script executable
chmod +x simulate-network
# Simulate a 3G network with 1% packet loss
sudo ./simulate-network 3g --loss 1
# Simulate wifi conditions (default delay and bandwidth)
sudo ./simulate-network wifi
# Reset all simulation and restore normal network behavior
sudo ./simulate-network reset| Speed | Bandwidth | Latency |
|---|---|---|
| edge | 240 Kbit/s | 400 ms |
| 3g | 750 Kbit/s | 200 ms |
| 4g | 4000 Kbit/s | 80 ms |
| wifi | 30000 Kbit/s | 20 ms |
- Jitter is not supported on macOS's
dnctl(it will be ignored with a warning) - Only one simulation can be active at a time
- Must be run with
sudo
simulate-networkβ the Bash scriptREADME.mdβ this file
Always run the following to restore your system to a normal state after testing:
sudo ./simulate-network reset