Nono.MA

Install vnstat with Homebrew

MARCH 22, 2023

I've installed vnstat on my M1 MacBook Pro with Homebrew to monitor my network usage over time.

# Install vnstat on macOS with Homebrew.
brew install vnstat

Make sure you start the vnstat service with brew for vnstat to monitor your network usage.

brew services start vnstat

vnstat will be running in the background, and you'll have to wait days for it to gather statistics and be able to show you, for instance, the average monthly usage.

› vnstat -m
# gif0: Not enough data available yet.

After a few minutes, you'll see stats on vnstat.

Last 5 minutes

› vnstat -5

# en0  /  5 minute
#
#         time        rx      |     tx      |    total    |   avg. rate
#     ------------------------+-------------+-------------+---------------
#     2023-03-19
#         12:45    839.44 MiB |    2.60 MiB |  842.04 MiB |   23.55 Mbit/s
#         12:50    226.26 MiB |  306.00 KiB |  226.56 MiB |   46.35 Mbit/s
#     ------------------------+-------------+-------------+---------------

Hourly

› vnstat -h

# en0  /  hourly
#
#         hour        rx      |     tx      |    total    |   avg. rate
#     ------------------------+-------------+-------------+---------------
#     2023-03-19
#         12:00      1.04 GiB |    2.90 MiB |    1.04 GiB |   28.10 Mbit/s
#     ------------------------+-------------+-------------+---------------

Monthly

› vnstat -m

# en0  /  monthly
#
#        month        rx      |     tx      |    total    |   avg. rate
#     ------------------------+-------------+-------------+---------------
#       2023-03      1.04 GiB |    2.90 MiB |    1.04 GiB |   28.10 Mbit/s
#     ------------------------+-------------+-------------+---------------
#     estimated      3.43 TiB |    9.56 GiB |    3.44 TiB |

You can read the guide to get familiar with the commands.

BlogCodeBrew