Skip to main content

mactop

Mactop is a tool like htop, but you can decide the data you want and decide the layout. It is more like a Grafana for your macbook, but in terminal.

It looks like this:

Installation

pip install mactop

Usage

sudo mactop

It requires sudo because powermetrics requires sudo, you can run mactop without sudo but some metrics will be missing.

For M1 Macbook users, please run:

sudo mactop -t m1.xml

What is -t here? It's for "theme"! And you can have your own theme!

Design Your Own Mactop

We use HTML + CSS style to setup the layout.

You can use id or class to select the element, like this:

<Mactop>
  <layout>
    <Horizontal id="row-1">
      <SensorsPanel></SensorsPanel>
    </Horizontal>
  </layout>

  <style>
    #row-1 {
      color: red;
    }
  </style>
</Mactop>

Save your content to a file, for example, my-theme.xml, then run mactop with mactop -t my-theme.xml.

Components do not support inline-css, but you can set attributes on components.

Common attributes that every components support:

  • id;
  • class or classes, separated by space;
  • refresh_interval: set this will overwrite command line arguments --refresh-interval for that component.

For component's supported attributes and component's name, please refer to mactop/panels/__init__.py and check the source code. Please bare with me, it is messy for now, I am working on documentations. If you have any questions, feel free to open an issue.

For examples of layouts, you can refer mactop/themes/ directory.

If you made some beautiful layout, please send it to me! By open a PR or issue, I can merge it into this repo, thanks.

Debug

Mactop comes with verbose log support.

-v means enable info log, and more v means more logs, max -vvv.

mactop -vvv -l mactop.log

Then you can open another terminal tail -f mactop.log to see the logs.

Mactop use powermetrics to get metrics from your mactop, powermetrics is different on different Macbooks. If you met some issue, better submit a powermetrics sample in the issue, thanks.

Use this command (add --debug), Mactop will write json formatted powermetrics file on your current $(PWD)/debug_json. (If you decide to paste it, only one sample (one file) is enough).

$ mactop -vvv -l mactop.log --debug
$ ls debug_json
mactop_debug_20231206_16:34:28.json  mactop_debug_20231206_16:41:55.json  mactop_debug_20231206_16:46:21.json
mactop_debug_20231206_16:34:29.json  mactop_debug_20231206_16:44:46.json

Development

This project use poetry to manage dependencies.

Clone this project and make sure you have poetry.

pip install poetry
git clone git@github.com:laixintao/mactop.git

Then install dependencies:

poetry install

You can then make changes, and test with poetry run mactop.

Metadata

Release files for mactop 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mactop 0.1.11
File Size Uploaded
mactop-0.1.11.tar.gz 38.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mactop 0.1.11
File Interpreter ABI Platform
mactop-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 94.5 kB

Release files / mactop-0.1.11.tar.gz

Download URL mactop-0.1.11.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3351f700c68afbd72383d1d62684e23bbbb62d0fe03a6b5a7fa713837d6b6fcc
BLAKE2b-256 checksum
How to use checksums
f011251d7efb6977fdf02f2c444430864c99beadb3ad24b0901965525053e58c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.12.0 Darwin/22.6.0

Release files / mactop-0.1.11-py3-none-any.whl

Download URL mactop-0.1.11-py3-none-any.whl
Size 56.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
255d85f540cd1ba4cf7dc0e0b4b388a27e75505d253c7796196b4ae0275bc180
BLAKE2b-256 checksum
How to use checksums
b94a65bfa95e2d86f1ee9240249048cbe22722037aa52b370c5bff271ac90fa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.0 CPython/3.12.0 Darwin/22.6.0

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page