Why Test Your Network Speed From Terminal?
You don't always need a browser to check how fast your internet is. The macOS Terminal gives you quick, accurate network speed tests right from the command line. It's lighter, faster, and gives you data you can log, script, and automate. Whether you're a developer, a sysadmin, or just someone who likes working in Terminal, this guide covers everything you need.
Built-In macOS Network Tools
macOS ships with several networking commands already installed. You don't need to download anything to start diagnosing your connection.
ping — Check Your Latency
The ping command sends small packets to a server and measures how long they take to come back. This round-trip time is your latency, measured in milliseconds (ms). Open Terminal and type:
ping -c 10 google.com
The -c 10 flag tells it to send exactly 10 packets, then stop. You'll see each packet's round-trip time plus a summary at the end with min, avg, max, and standard deviation. If your average is under 20 ms, that's excellent. Between 20–50 ms is good for most tasks. Over 100 ms and you'll start noticing lag. For a more detailed check, try our dedicated ping test.
networkQuality — Apple's Built-In Speed Test
Starting with macOS Monterey (12.0), Apple added a command called networkQuality. It's basically a speed test built right into your operating system. Just type:
networkquality
It measures download speed, upload speed, and something Apple calls RPM (Responsiveness Per Minute) — which is a measure of how well your network handles traffic under load. An RPM score of "High" means your connection stays responsive even when it's busy. Here's what the RPM ratings mean:
| RPM Rating | Flows | What It Means |
|---|---|---|
| Low | Under 200 | Noticeable lag during video calls or gaming |
| Medium | 200–800 | Fine for most everyday use |
| High | Over 800 | Great responsiveness, even under heavy load |
You can also run it in verbose mode with networkquality -v to get more details, or test upload and download separately with networkquality -s (sequential mode instead of simultaneous).
traceroute — Map Your Connection Path
The traceroute command shows every hop your data takes between your Mac and a destination server. Type:
traceroute google.com
Each line is a router along the path. You'll see three time measurements per hop. If one hop suddenly jumps from 10 ms to 200 ms, that's where the bottleneck is. This is great for figuring out why your internet is slow — it tells you whether the problem is on your end, your ISP's network, or somewhere further along.
Install the Speedtest CLI
For a full download and upload speed test from Terminal, Ookla offers an official command-line tool called Speedtest CLI. It uses the same server network as the browser-based Speedtest and gives you accurate results.
Installing With Homebrew
The easiest way to install it is with Homebrew, the popular macOS package manager. If you don't have Homebrew yet, install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then install Speedtest CLI:
brew install speedtest-cli
Once it's installed, just run:
speedtest-cli
You'll get your download speed, upload speed, ping, and the server you tested against — all printed right in your terminal window.
Useful Speedtest CLI Flags
Here are some handy options:
speedtest-cli --simple— Shows only ping, download, and upload in a clean three-line output.speedtest-cli --server 12345— Tests against a specific server by ID.speedtest-cli --list | grep "City"— Find servers near a specific city.speedtest-cli --csv— Outputs results as CSV, perfect for logging to a file.
Want to log your speed over time? Try this one-liner that appends timestamped results to a file:
echo "$(date)," $(speedtest-cli --csv) >> ~/speed_log.csv
Set that up as a cron job and you'll have a full history of your connection speed.
Terminal vs. Browser Speed Tests
You might wonder how Terminal results compare to browser-based tests like the one on our homepage. Here's a quick comparison:
| Feature | Terminal (CLI) | Browser Test |
|---|---|---|
| Download/Upload Speed | Yes | Yes |
| Ping/Latency | Yes | Yes |
| Jitter | Manual calculation | Yes (automatic) |
| Packet Loss | Via ping command | Yes (automatic) |
| Scriptable / Automatable | Yes | No |
| Visual Interface | No | Yes |
| Browser Overhead | None | Slight (2–5%) |
Terminal tests tend to show slightly higher speeds because there's no browser eating up CPU and memory. The difference is usually small — around 2–5% — but on very fast connections (500 Mbps+), that gap can widen. If your plan promises gigabit speeds and you're only seeing 600 Mbps in a browser, try the CLI test to see if you get closer to 900+ Mbps.
Other Useful Terminal Commands for Network Testing
curl — Quick Download Speed Check
You can use curl to download a test file and see how fast it goes. This won't give you upload speed, but it's a fast way to check download throughput without installing anything:
curl -o /dev/null -w "Speed: %{speed_download} bytes/sec\n" https://speed.hetzner.de/100MB.bin
This downloads a 100 MB test file, throws away the file itself (sends it to /dev/null), and prints only the download speed. Divide the result by 125,000 to convert bytes per second to megabits per second (Mbps).
dns — Check Your DNS Speed
Slow DNS lookups can make your internet feel sluggish even when your bandwidth is fine. Test how fast your DNS responds with:
dig google.com | grep "Query time"
You'll see the query time in milliseconds. Under 10 ms is fast. Over 50 ms and you should consider switching DNS providers. Popular options like Cloudflare (1.1.1.1) and Google (8.8.8.8) typically respond in 1–5 ms. You can run a more thorough check with our DNS test tool.
mtr — Ping + Traceroute Combined
If you install mtr (via brew install mtr), you get a live, updating view that combines ping and traceroute. It continuously pings every hop and shows packet loss percentages and jitter at each point. It's one of the best tools for diagnosing exactly where a network problem lives.
sudo mtr google.com
Watch it for 30–60 seconds to get stable readings. Any hop showing more than 1% packet loss is worth investigating.
Automate Speed Tests With Cron
One of the biggest advantages of Terminal testing is automation. You can schedule tests to run every hour, every day, or whatever interval you want. Open your crontab with:
crontab -e
Then add a line like this to test every 6 hours:
0 */6 * * * /usr/local/bin/speedtest-cli --csv >> ~/speed_log.csv 2>&1
After a week, you'll have about 28 data points showing how your speed varies throughout the day. This is really useful when you're arguing with your ISP about slow speeds — you'll have hard data to back it up. You can compare your results against ISP speed rankings to see how your provider stacks up.
Quick Summary
macOS gives you solid network testing tools right out of the box. Use ping for latency, networkquality for a quick built-in speed test, and traceroute to find bottlenecks. Install Speedtest CLI through Homebrew for full download and upload measurements. Use curl for a no-install download check. Set up a cron job to track your speeds over time. Terminal tests are faster, more scriptable, and slightly more accurate than browser tests — but browser tests are easier to read and measure more metrics automatically. Use both for the best picture of your connection.