macOS Terminal command to test Internet speed

Anyone know what command can I use to check my Internet speed in the Terminal app?

May be I can use curl command and add some IP addresses, like the to check our IP and Country location via curl ipinfo.io command?


Solution 1:

There is a CLI version of Speedtest called, appropriately, speedtest-cli.

You can install it via Homebrew:

brew install speedtest-cli

It's also available via MacPorts

Just execute it by running the command:

$ speedtest-cli


Retrieving speedtest.net configuration...
Testing from ACME Cable (xxx.xxx.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by ServerPronto (Miami, FL) [22.39 km]: 25.419 ms 
Testing download speed............................................................
Download: 70.16 Mbit/s
Testing upload speed............................................................
.Upload: 5.92 Mbit/s

Solution 2:

If you have macOS Monterey or later in your system, here is how you can test Internet speed:-

  1. Go to Terminal
  2. Type networkQuality -v and Press Enter

You will see internet speed test running inside your terminal & returning the result within a minute.

Sample Output:-

==== SUMMARY ====                                                                                         
Upload capacity: 18.856 Mbps
Download capacity: 98.696 Mbps
Upload flows: 20
Download flows: 12
Responsiveness: Low (121 RPM)
Base RTT: 273
Start: 28/11/21, 1:06:09 AM
End: 28/11/21, 1:06:28 AM
OS Version: Version 12.0.1 (Build XXXXXX)

(Source: https://support.apple.com/en-gb/HT212313)

UPDATED:- In case you are willing to test in earlier versions of macOS, just run the following in your terminal.

curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

Solution 3:

Install iPerf3 from the developer: iPerf - The ultimate speed test tool for TCP, UDP and SCTP. This is a stand-alone cli, which doesn't require brew or MacPorts.

In the Terminal enter:

iperf3 -c <server-ip>

to get the upload speed/bandwidth and:

iperf3 -c <server-ip> -R

to get the download speed/bandwidth

You can get some public iPerf servers here: Public iPerf3 servers. Other servers are available by searching for iperf/iperf3 servers with Google.

I have tested this one: https://speedtest.wtnet.de/ (while watching TV online) with the following results:

iperf3 -c speedtest.wtnet.de -p 5200 -P 10 -4
...
[SUM]   0.00-10.00  sec  12.1 MBytes  10.1 Mbits/sec                  sender
[SUM]   0.00-10.00  sec  10.9 MBytes  9.17 Mbits/sec                  receiver

iperf3 -c speedtest.wtnet.de -p 5200 -P 10 -4 -R
...
[SUM]   0.00-10.00  sec  54.2 MBytes  45.5 Mbits/sec  558             sender
[SUM]   0.00-10.00  sec  51.8 MBytes  43.5 Mbits/sec                  receiver

The 558 in the third sum is the number of retransmitted TCP segments (Retr)!