23

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?

1

4 Answers 4

41

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
3
  • 1
    I think this is the simplest method, it doesn't need sudo privilege and the command will find nearest server to check the speed. It also display the distance of the server (in Kilometer) with my IP address). I'm using VPN, so Retrieving speedtest.net server list... and Selecting best server based on ping... processes need longer time.
    – Caldas
    Commented Mar 9, 2018 at 7:57
  • the command is not speedtest_cli, but speedtest-cli
    – Caldas
    Commented Mar 11, 2018 at 3:52
  • Also available at speedtest.net/apps/cli
    – lhf
    Commented Nov 28, 2021 at 12:00
31

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 -
4
  • Does networkQuality work in BigSur? I mean, can I copy it to a Big Sur machine and run it?
    – lhf
    Commented Dec 16, 2021 at 14:38
  • @lhf I have updated the answer for earlier macOS versions, kindly try that. Commented Dec 17, 2021 at 6:12
  • 1
    This is easy and work so good
    – DecPK
    Commented Feb 22, 2022 at 10:40
  • Details about networkQuality with info on rpm=roundtrips per min. Probably the non-verbose without -v should be enough
    – Timo
    Commented Jun 9 at 9:51
8

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)!

3
  • I've tried @Allan method for this case. But, may this command will be usefule for other user.
    – Caldas
    Commented Mar 9, 2018 at 7:59
  • It is available in brew using brew install iperf.
    – Alper
    Commented Dec 30, 2020 at 11:11
  • For me this is the best way to get the information in a clear way. I'm using it on Ventura after brew install Thank you for sharing @klanomath
    – Camaleo
    Commented Jun 1 at 8:29
-1

Ping and traceroute are legendary unix utilities.

macworld’s explanation

TL;DR ping measures stats about a network path. Your computer/network switch/router/modem is connected to your internet provider/gateway. The gateway has an ip-address xxx.xxx. xxx.xxx, just like your computer and your router. Try

sudo time ping -s 1024 -c 1024 xxx.xxx. xxx.xx

This will send 1Kilobit 1024 times. Check the total time and do the math. 10 kilobits is roughly 1 kilobyte (due to parity checks).

2
  • How can you measure connection speed with them?
    – nohillside
    Commented Mar 8, 2018 at 17:48
  • 1
    Well, we'll net scientific calculator after sending this command.
    – Caldas
    Commented Mar 9, 2018 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .