Bopping About with btop: Installing btop on MacOS

For years, when troubleshooting issues on *nix-like systems (say, MacOS), I’ve often used top. This was pretty much a standard tool to check things like CPU usage, memory and so on. The challenge is that for someone who tends to like some decent visuals, top can be overwhelming and somewhat clunky to use.

As it happened, tonight, while fighting some insomnia I was scrolling through Bluesky and came across a post on something called btop.

It looks impressive and far more clearer about usage. From a troubleshooting perspective, it gives a more complete look at all resources but also can be used to drill down to specifics. So I decided to go about installing it, which proved a little more complicated than I expected. The steps are simple.

  1. Install xcode (DO NOT just download it from the Mac store)
  2. Install xcode command-line
  3. Install ports (MacPorts)
  4. Install xorg-server port
  5. Install btop

Install xcode & xcode command-line

So first, I needed to get xcode and the CLI installed (this article from freeCodeCamp is what I used to get started). Now, you could go to the Mac store and install xcode from there but it can be a challenge to troubleshoot. It’s better to go to the Apple Developer website and download it from there. You’ll end up downloading a “Xip” file (eXtensible Information Packaging). While xip files are similar to zip files, there are some marked differences:

  • native to MacOS
  • auto-launches archive utility
  • has built in function to check the file’s digital security
  • if you want to do manual decompression, use xip --expand [filename.xip]

That digital security step is a nice functionality.

Back to our install: once I downloaded and installed xcode, I copied the xcode app to the Applications folder. I recommend launching the app so that you have all the necessary bits if you want to get more adventurous with coding on MacOS.

With xcode is installed, go and install the CLT (command-line tool). This is a dmg file so it should behave like any other app that you’ve installed on MacOS. (You don’t need to do the brew config step as brew isn’t installed as part of the 16.x version).

It is important to do the license part of xcode. Run sudo xcodebuild -license and agree to the license. Once agreed, launch xcode from Applications. There you’ll have the choice of the kinds of apps you may want to build. At the least, ensure that MacOS is selected.

Install MacPorts

So what is MacPorts? Basically, it makes it easier to install and upgrade open source software on a Mac. Right now, there are nearly 40,000 ported apps including some rather popular ones like git, wget, ImageMagick and nmap to name a few.

Go to the MacPorts site and download the version for your MacOS (as of time of writing, I’m using Sequoia). Since this is a pkg file, it should be fairly straightforward. Now, you also may want to install some additional fonts in preparation of btop (NerdFonts is a great place to get these).

Now, the install instructions say that you should use the sudo port -v selfupdate once it’s installed. But one of the challenges I noticed is that MacPorts doesn’t end up in the $PATH info. So make sure to run the following in a Terminal to ensure that you have the correct path info: export PATH="$PATH:/opt/local/bin".

Once your $PATH is correct, you should see something like this:

At this point, run the sudo port -v selfupdate or a command like man port to get the help page.

Install xorg-server (optional)

With ports installed, you can now install Xorg/Xquartz X server. This is really simple but can take time (about 10 minutes). Simply run the command sudo port install xorg-server. And then go grab a coffee or whatever.

Install btop

So now we get to install btop using sudo port install btop. This takes about 2-3 minutes and when done just type btop. You can change the view to one of the following:

  1. Hit 1 and get CPU
  2. Hit 2 and get MEM (memory)
  3. Hit 3 and get NET (network)
  4. Hit 4 and get PROC (Processes)
  5. Hit 5-0 will get GPU
  6. Hit esc to Show the Menu

The menu option will let you select Options, Help or Quit. Select Options to configure btop settings like Color Theme (there are 33 default themes that change the colour to what you’d prefer); usage of Vim keys; how often to update; Graph Symbols (it defaults to using braille but not all systems have sufficient fonts for this which is why it’s good to download a few extra); and so on.

For my own preference I set the theme to TTY and turned off various battery options (I use a MacStudio so no need for battery). Make sure that you choose your theme and then quit. This will save it. While I was playing with it, the system crashed the app and didn’t save the theme. So doing a proper quit will save that.

Image of btop running on my MacStudio
Image of btop running on my MacStudio

For reference this is the present that shows all the resources. Starting with the top box is the CPU activity.

CPU usage on my MacStudio. It shows the breakdown of the 12 CPUs and how much they are being used.

Under the CPU, on the left side, is MEM (memory usage).

Beside that is disk usage.

Hitting i can change it to IO.

Under MEM and disks is NET (network).

And last but not least is PROC (processes).

Now this defaults to CPU lazy but you can change the focus using the arrow keys.

So I highly recommend installing it if you want more info about your Mac (or other OSes). There are versions for bsd, Linus and Windows (I may install it on my gaming system to see what is causing the fans to run super high randomly when I play Warcraft).

As a final side note, freeCodeCamp is a great place to check out some free training. They even have a structure path to learn!



Leave a Reply

Discover more from The Virtual Buddha: Learning How to Navigate the World

Subscribe now to keep reading and get access to the full archive.

Continue reading