Test Internet Speed in Mac Terminal Using Curl

We can use curl to roughly test your download speed by fetching a file from a server. Though this method doesn’t provide upload speed or ping information, it can give you a quick estimate of your download performance.

In this guide, we’ll walk you through how to test your internet speed using the curl command in Mac Terminal.

Testing Download Speed Using Curl

The curl command allows you to download a file from a server and measure the speed at which it downloads. By using a public server with a test file, you can estimate your download speed. The following steps will guide you through the process.

Step 1: Choose a Test File

Many websites offer large test files that can be used for network speed testing. One popular option is the Tele2 speed test server, which provides files of different sizes. For example, you can use the 100 MB file from their server:

http://speedtest.tele2.net/100MB.zip

This file will allow you to measure your download speed over a reasonable period of time.

Step 2: Use Curl to Download the File

Next, open your Mac Terminal and use the following curl command to start downloading the file. This command will download the file but discard it, so you won’t actually save it to your computer:

curl -o /dev/null http://speedtest.tele2.net/100MB.zip

In this command:

  • -o /dev/null tells curl to discard the file after downloading. This prevents it from being saved to your computer.
  • http://speedtest.tele2.net/100MB.zip is the URL of the test file you are downloading.

Once you run this command, curl will begin downloading the file and display real-time statistics about the download, including the download speed.

Step 3: Interpreting the Results

After you run the command, you will see output in the Terminal similar to this:

In this output:

  • 100 100M indicates that the file has been downloaded completely.
  • 11.0M refers to the average download speed, which in this case is 11.0 MB/s (megabytes per second).

To convert this to megabits per second (Mbps), multiply the result by 8. For example, if the speed is 11.0 MB/s, it would be approximately 88 Mbps (11.0 * 8 = 88).

Optional: Testing Different File Sizes

If you want to test different speeds over various file sizes, you can choose a smaller or larger file from the Tele2 server. For example:

  • 50 MB file: http://speedtest.tele2.net/50MB.zip
  • 1 GB file: http://speedtest.tele2.net/1GB.zip

Simply replace the URL in the curl command to test different file sizes:

curl -o /dev/null http://speedtest.tele2.net/50MB.zip

Limitations of Using Curl for Speed Testing

While using curl is a simple way to get an estimate of your download speed, there are some limitations to this method:

  • No upload speed: curl only tests download speed and does not measure upload speed.
  • Server-dependent: The speed you measure depends on the server you’re downloading from. If the server is slow or located far away, the download speed may not reflect your true internet speed.
  • No latency (ping): curl does not provide latency (ping) measurements, which are important for activities like gaming or video conferencing.