macpm 2.0__tar.gz → 2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- macpm-2.2/CHANGELOG.md +123 -0
- macpm-2.2/PKG-INFO +370 -0
- macpm-2.2/README.md +329 -0
- macpm-2.2/RELEASE.md +155 -0
- {macpm-2.0 → macpm-2.2}/macpm/__init__.py +1 -1
- {macpm-2.0 → macpm-2.2}/macpm/macpm.py +520 -103
- macpm-2.2/macpm/netinfo.py +326 -0
- macpm-2.2/macpm/network.py +735 -0
- macpm-2.2/macpm/processes.py +623 -0
- {macpm-2.0 → macpm-2.2}/macpm/sampler.py +60 -3
- macpm-2.2/macpm/sensors.py +133 -0
- {macpm-2.0 → macpm-2.2}/macpm/smc.py +33 -13
- macpm-2.2/macpm/tui.py +79 -0
- macpm-2.2/macpm.egg-info/PKG-INFO +370 -0
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/SOURCES.txt +11 -4
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/entry_points.txt +0 -1
- {macpm-2.0 → macpm-2.2}/packaging/README.txt +8 -5
- {macpm-2.0 → macpm-2.2}/packaging/build.sh +7 -17
- {macpm-2.0 → macpm-2.2}/packaging/install.sh +3 -5
- {macpm-2.0 → macpm-2.2}/setup.py +1 -2
- {macpm-2.0 → macpm-2.2}/tests/test_cli.py +2 -1
- macpm-2.2/tests/test_layout.py +159 -0
- macpm-2.2/tests/test_netinfo.py +295 -0
- macpm-2.2/tests/test_network.py +495 -0
- macpm-2.2/tests/test_processes.py +157 -0
- macpm-2.2/tests/test_sampler.py +35 -0
- macpm-2.2/tests/test_sensors.py +86 -0
- macpm-2.0/CHANGELOG.md +0 -45
- macpm-2.0/PKG-INFO +0 -253
- macpm-2.0/README.md +0 -212
- macpm-2.0/RELEASE.md +0 -102
- macpm-2.0/macpm/sensors.py +0 -56
- macpm-2.0/macpm.egg-info/PKG-INFO +0 -253
- macpm-2.0/packaging/__pycache__/entry_sensors.cpython-312.pyc +0 -0
- macpm-2.0/packaging/__pycache__/entry_tui.cpython-312.pyc +0 -0
- macpm-2.0/packaging/entry_sensors.py +0 -4
- {macpm-2.0 → macpm-2.2}/LICENSE +0 -0
- {macpm-2.0 → macpm-2.2}/MANIFEST.in +0 -0
- {macpm-2.0 → macpm-2.2}/macpm/__main__.py +0 -0
- {macpm-2.0 → macpm-2.2}/macpm/dump.py +0 -0
- {macpm-2.0 → macpm-2.2}/macpm/ioreport.py +0 -0
- {macpm-2.0 → macpm-2.2}/macpm/soc.py +0 -0
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/dependency_links.txt +0 -0
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/not-zip-safe +0 -0
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/requires.txt +0 -0
- {macpm-2.0 → macpm-2.2}/macpm.egg-info/top_level.txt +0 -0
- {macpm-2.0 → macpm-2.2}/packaging/entry_tui.py +0 -0
- {macpm-2.0 → macpm-2.2}/packaging/macpm.command +0 -0
- {macpm-2.0 → macpm-2.2}/pyproject.toml +0 -0
- {macpm-2.0 → macpm-2.2}/setup.cfg +0 -0
- {macpm-2.0 → macpm-2.2}/tests/__init__.py +0 -0
- {macpm-2.0 → macpm-2.2}/tests/test_calc_freq.py +0 -0
macpm-2.2/CHANGELOG.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.2 — 2026-11-12
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **Network view** on key `4` — a rootless overview built from `nettop`: TCP
|
|
8
|
+
socket counts by state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`, `TIME_WAIT`),
|
|
9
|
+
UDP socket count, interface throughput, a listening table (address, PID,
|
|
10
|
+
process) and a per-process traffic table with socket count and download /
|
|
11
|
+
upload rates. `Tab` switches the focused table, `s` cycles its sort column,
|
|
12
|
+
`↑` / `↓` scroll it and `Space` pauses sampling. The traffic table
|
|
13
|
+
refreshes every 2 seconds and the full socket snapshot every 5 seconds while
|
|
14
|
+
the view is open. `nettop` needs no root and sees sockets owned by root
|
|
15
|
+
daemons; sockets without an owner (typically `TIME_WAIT`) are not reported.
|
|
16
|
+
- The network summary box has a line with the active IPv4 interface and prefix,
|
|
17
|
+
the default gateway, and the public IP with its city. For Chinese addresses
|
|
18
|
+
the carrier abbreviation (Telecom, Unicom, Mobile) is appended after the
|
|
19
|
+
country code, e.g. `Shanghai, CN Telecom`.
|
|
20
|
+
The public lookup is one HTTPS request to `ipinfo.io` (falling back to
|
|
21
|
+
`ipwho.is`), cached for 10 minutes and disabled with `--no-public-ip`.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- The network summary uses fixed-width fields, so the labels no longer move as
|
|
26
|
+
the counter and rate values change. The traffic table is sorted by the
|
|
27
|
+
visible `↓/s` column by default; the combined rate is no longer a hidden sort
|
|
28
|
+
key.
|
|
29
|
+
- The Temps & Fans panel now pairs each component's temperature with its peak
|
|
30
|
+
(CPU on one row, GPU on the next), followed by fan RPMs and one fan-load bar
|
|
31
|
+
per fan. The bars omit the numeric percentage so they can use the full panel
|
|
32
|
+
width. The network identity line is only shown in view 1, not in the
|
|
33
|
+
per-core view.
|
|
34
|
+
- README: screenshots for the process and network views and refreshed
|
|
35
|
+
highlights.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Arrow keys were delivered as a bare `ESC` — which quits macpm — because the
|
|
40
|
+
curses window never enabled keypad mode. `↑` / `↓` now scroll the process
|
|
41
|
+
and network tables as documented.
|
|
42
|
+
- The views reset only the foreground colour after drawing, not the whole SGR
|
|
43
|
+
state. A full reset also cleared the black background set by curses, so the
|
|
44
|
+
terminal profile's background (often grey) showed through in the default,
|
|
45
|
+
process and network views.
|
|
46
|
+
|
|
47
|
+
## 2.1 — 2026-11-11
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- The power panel is titled `Power` instead of `CPU+GPU+ANE Power`, and every
|
|
52
|
+
panel title is clipped to its box so a long title never wraps the frame.
|
|
53
|
+
- The Temps & Fans panel now uses its spare rows for CPU/GPU peak temperatures
|
|
54
|
+
and fan limits instead of leaving them blank.
|
|
55
|
+
- Per-core gauges are labelled `E1…` / `P1…` instead of `Core-1` / `C-1`, so
|
|
56
|
+
narrow gauges keep the percentage readable.
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- **Temps & Fans panel** in the default view — hottest CPU and GPU sensor in
|
|
61
|
+
°C and the current RPM of every fan, read from `AppleSMC` without root.
|
|
62
|
+
- **Process view** on key `3` — a two-box layout: a
|
|
63
|
+
CPU/GPU/RAM summary box (with wired/active/inactive/free memory) and a
|
|
64
|
+
process table with PID, NAME, USER, CPU%, MEM and GPU% columns, sorted with
|
|
65
|
+
`s`, scrolled with `↑`/`↓` and paused with `Space`. The table refreshes
|
|
66
|
+
every 2 seconds to keep macpm's own CPU low. There is no power column.
|
|
67
|
+
|
|
68
|
+
### Removed
|
|
69
|
+
|
|
70
|
+
- The separate `macpm-sensors` command. The SMC reader is now part of the TUI
|
|
71
|
+
(`macpm.sensors.SensorReader`).
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
- Impossible power peaks (such as `peak: 6208.38W`) caused by coalesced or
|
|
76
|
+
reset Energy Model counters are now discarded instead of being recorded.
|
|
77
|
+
- When the unprivileged Energy Model counters never report, the power panel
|
|
78
|
+
shows `n/a` instead of a misleading `0.00W`; the total is withheld only when
|
|
79
|
+
both CPU and GPU are unreadable.
|
|
80
|
+
|
|
81
|
+
## 2.0 — 2026-11-10
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- **Rootless by default**: macpm no longer runs `sudo`, `powermetrics` or any
|
|
86
|
+
privileged helper. Data is collected from IOReport, IOKit, `psutil`,
|
|
87
|
+
`sysctl`, `ioreg` and `pmset`.
|
|
88
|
+
- Reworked the sampler into `macpm.sampler`, with ctypes bindings in
|
|
89
|
+
`macpm.ioreport` and SoC/DVFS discovery in `macpm.soc`.
|
|
90
|
+
- The terminal layout, panel titles, charts, colours and key bindings remain
|
|
91
|
+
the same as macpm 0.x.
|
|
92
|
+
- Version bumped to 2.0.
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
|
|
96
|
+
- `macpm-sensors` / `macpm.sensors` — read SMC temperatures and fan speeds
|
|
97
|
+
without root (read-only).
|
|
98
|
+
- `macpm-dump` / `macpm.dump` — print the rootless metrics as JSON for
|
|
99
|
+
debugging.
|
|
100
|
+
- Optional per-core view improvements and reset/peak handling retained from
|
|
101
|
+
0.24.
|
|
102
|
+
- `--version` flag.
|
|
103
|
+
- Compatibility notes for macOS 12–27, M1–M4 and partial M5/Ultra support.
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- `--show_cores` now accepts a real boolean value and `--show_cores` alone.
|
|
108
|
+
- Zero-division guards for `--avg < --interval` and for chips without E cores.
|
|
109
|
+
- No child `powermetrics` process is left behind when the TUI exits.
|
|
110
|
+
- `ioreg` output is filtered at the source to avoid retaining tens of MB of
|
|
111
|
+
XML in the Python allocator.
|
|
112
|
+
- Only the required `Energy Model` channels are subscribed, reducing memory
|
|
113
|
+
and CPU usage.
|
|
114
|
+
|
|
115
|
+
### Removed
|
|
116
|
+
|
|
117
|
+
- `sudo echo` pre-authentication and the `sudo nice powermetrics` subprocess.
|
|
118
|
+
- The `macpm2` development package (merged into `macpm`).
|
|
119
|
+
|
|
120
|
+
## 0.24
|
|
121
|
+
|
|
122
|
+
- Last 0.x release: `sudo` + `powermetrics` based sampler, Python TUI with
|
|
123
|
+
CPU/GPU/ANE power, RAM, disk and network panels.
|
macpm-2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: macpm
|
|
3
|
+
Version: 2.2
|
|
4
|
+
Summary: Rootless performance monitoring CLI tool for Apple Silicon
|
|
5
|
+
Home-page: https://github.com/visualcjy/macpm
|
|
6
|
+
Author: Jinyu Chen
|
|
7
|
+
Author-email: visualcjy@mail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Source, https://github.com/visualcjy/macpm
|
|
10
|
+
Project-URL: Issues, https://github.com/visualcjy/macpm/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/visualcjy/macpm/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: macpm apple-silicon monitor performance ioReport psutil
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Operating System :: MacOS
|
|
20
|
+
Classifier: Environment :: Console
|
|
21
|
+
Classifier: Topic :: System :: Monitoring
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: dashing>=0.1
|
|
26
|
+
Requires-Dist: psutil>=5.9
|
|
27
|
+
Requires-Dist: humanize>=4.0
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: keywords
|
|
35
|
+
Dynamic: license
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: project-url
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: requires-python
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# macpm
|
|
43
|
+
|
|
44
|
+
**Rootless performance monitoring CLI for Apple Silicon.**<br>
|
|
45
|
+
macpm 2.2 reads the same hardware counters as `powermetrics`, but through
|
|
46
|
+
IOReport/IOKit/SMC — no `sudo`, no password, no privileged helper.
|
|
47
|
+
|
|
48
|
+
A Python-based `nvtop`-inspired terminal monitor for Apple Silicon Macs,
|
|
49
|
+
forked from [asitop](https://github.com/tlkh/asitop).
|
|
50
|
+
|
|
51
|
+
## Demo
|
|
52
|
+
|
|
53
|
+
Default view — CPU/GPU/ANE utilisation and power, memory, temperatures/fans,
|
|
54
|
+
disk I/O and network, updating once per second:
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
Same view in another colour theme (press ← / → to cycle through them):
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
|
|
62
|
+
Per-core view (`--show_cores`, or press `2` while running):
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
Process view (press `3` while running):
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
Network view (press `4` while running):
|
|
71
|
+
|
|
72
|
+

|
|
73
|
+
|
|
74
|
+
## Highlights
|
|
75
|
+
|
|
76
|
+
- **No sudo required.** `macpm` runs as a normal user process.
|
|
77
|
+
- CPU E/P core utilisation and frequency, plus an optional per-core view
|
|
78
|
+
- GPU utilisation and frequency
|
|
79
|
+
- CPU / GPU / ANE power, rolling average, peaks and throttle state
|
|
80
|
+
- RAM and swap usage
|
|
81
|
+
- CPU/GPU temperature, peak and fan-load panel (SMC, read-only, no root)
|
|
82
|
+
- Disk IOPS/throughput and network throughput
|
|
83
|
+
- Process view (`3`) with per-process CPU, memory and GPU usage, sortable with `s`
|
|
84
|
+
- Network view (`4`) with TCP state counts, listening ports, per-process traffic
|
|
85
|
+
and the local/public IP, gateway and city
|
|
86
|
+
- Key-hint footer in every view; the default view also fills the terminal and
|
|
87
|
+
shows the network identity in the processor box when there is room
|
|
88
|
+
- Familiar terminal layout, colours, charts and key bindings from macpm 0.x
|
|
89
|
+
|
|
90
|
+
## Install
|
|
91
|
+
|
|
92
|
+
Requirements: **Apple Silicon Mac**, **macOS 12+**, **Python 3.9+**.
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
python3 -m pip install --upgrade macpm
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Then run:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
macpm
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
There is **no `sudo macpm`** since 2.0. Running it with `sudo` still works, but it
|
|
105
|
+
is unnecessary and no longer recommended.
|
|
106
|
+
|
|
107
|
+
Prefer a standalone binary with no Python installation? See
|
|
108
|
+
[Standalone binaries](#standalone-binaries).
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
macpm [--interval INTERVAL] [--color COLOR] [--avg AVG] [--show_cores [BOOL]] [--no-public-ip] [--version]
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
| Option | Meaning |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `--interval SECONDS` | Sampling and display interval (default `1`) |
|
|
119
|
+
| `--color 1-8` | Display colour (default `2`) |
|
|
120
|
+
| `--avg SECONDS` | Averaging window for power values (default `30`) |
|
|
121
|
+
| `--show_cores [BOOL]` | Start in the per-core view |
|
|
122
|
+
| `--no-public-ip` | Do not look up the public IP and location |
|
|
123
|
+
| `--version` | Print the version |
|
|
124
|
+
|
|
125
|
+
The default view also has a footer with the key hints. Keys:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
q / ESC quit
|
|
129
|
+
← / → change colour
|
|
130
|
+
1 / 2 / 3 / 4 default / per-core / process / network view
|
|
131
|
+
s cycle the sort column (process / network view)
|
|
132
|
+
↑ / ↓ scroll the list or the focused network pane
|
|
133
|
+
Space pause / resume the list (process / network view)
|
|
134
|
+
Tab switch the focused network pane
|
|
135
|
+
Ctrl+R reset peaks
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Colour themes
|
|
139
|
+
|
|
140
|
+
Pick one with `--color N`, or press ← / → while macpm is running. The default
|
|
141
|
+
is `2` (green).
|
|
142
|
+
|
|
143
|
+
| | |
|
|
144
|
+
|---|---|
|
|
145
|
+
| **1 — red**<br> | **2 — green (default)**<br> |
|
|
146
|
+
| **3 — yellow**<br> | **4 — blue**<br> |
|
|
147
|
+
| **5 — magenta**<br> | **6 — cyan**<br> |
|
|
148
|
+
| **7 — white**<br> | **8 — grey**<br> |
|
|
149
|
+
|
|
150
|
+
## Why no sudo?
|
|
151
|
+
|
|
152
|
+
macpm 0.x called `sudo powermetrics`. In 2.0 the sampler reads the underlying
|
|
153
|
+
counters directly. The data is not secret; the old `powermetrics` CLI simply
|
|
154
|
+
requires root and Apple's private entitlements.
|
|
155
|
+
|
|
156
|
+
| Metric | Source |
|
|
157
|
+
|---|---|
|
|
158
|
+
| CPU E/P load and frequency | IOReport `CPU Stats` performance states |
|
|
159
|
+
| Per-core load | IOReport `CPU Core Performance States` |
|
|
160
|
+
| GPU load and frequency | IOReport `GPU Stats` / `GPU Performance States` |
|
|
161
|
+
| CPU / GPU / ANE power | IOReport `Energy Model` |
|
|
162
|
+
| RAM / swap | `psutil` |
|
|
163
|
+
| Disk / network throughput | `psutil` counters |
|
|
164
|
+
| Sockets, listeners, per-process traffic | `nettop` |
|
|
165
|
+
| Local IP / prefix / gateway | `psutil`, `route -n get default` |
|
|
166
|
+
| Public IP / city | `ipinfo.io` (fallback `ipwho.is`) |
|
|
167
|
+
| Per-process CPU / memory | `psutil`, plus `/bin/ps` for other users |
|
|
168
|
+
| Per-process GPU | `IOAccelerator` user clients in the IORegistry |
|
|
169
|
+
| CPU/GPU temperature, fan RPM | `AppleSMC` via the IOKit user client |
|
|
170
|
+
| Thermal throttle | `pmset -g therm` |
|
|
171
|
+
| SoC name / core counts | `sysctl` |
|
|
172
|
+
| GPU core count | `ioreg` `gpu-core-count` |
|
|
173
|
+
|
|
174
|
+
The DVFS frequency tables are parsed from the `pmgr` IORegistry node;
|
|
175
|
+
M1–M3 store Hz there, M4+ store kHz.
|
|
176
|
+
|
|
177
|
+
## Temperatures and fans
|
|
178
|
+
|
|
179
|
+
The default view has a **Temps & Fans** box next to the memory gauge. It shows
|
|
180
|
+
the hottest CPU and GPU sensor with their peaks since the last reset (CPU on
|
|
181
|
+
one row, GPU on the next), the current RPM of every fan, and a fan-load bar
|
|
182
|
+
for each fan (current speed as a
|
|
183
|
+
percentage of its maximum RPM, without a numeric percentage so the bars can
|
|
184
|
+
use the full panel width):
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
┌ Temps & Fans ────────────────────────────────┐
|
|
188
|
+
│ CPU 52.4°C peak 61.5°C │
|
|
189
|
+
│ GPU 43.1°C peak 50.0°C │
|
|
190
|
+
│ Fan 1 2318 rpm Fan 2 2502 rpm │
|
|
191
|
+
│ F1 ▉▉▉▉▉▉▉▉▉▉▉▉ F2 ▉▉▉▉▉▉▉▉▉▉▉▉▉ │
|
|
192
|
+
└──────────────────────────────────────────────┘
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The values come from `AppleSMC` through the IOKit user client (read-only, no
|
|
196
|
+
root). SMC key names differ between chip generations, so the CPU/GPU sensor
|
|
197
|
+
groups are selected per chip family and a missing key is simply shown as `--`.
|
|
198
|
+
Fan **control** requires root and is not implemented.
|
|
199
|
+
|
|
200
|
+
## Process view
|
|
201
|
+
|
|
202
|
+
Press `3` for a two-box layout. The top box is titled with the
|
|
203
|
+
SoC and core counts (as in views 1/2) and keeps the top-style CPU (E/P
|
|
204
|
+
percentages and frequencies), GPU (%, MHz), RAM/swap and
|
|
205
|
+
wired/active/inactive/free memory summary. The second box is the
|
|
206
|
+
process table with `PID`, `NAME`, `USER`, `CPU%`, `MEM` and `GPU%`; there is no
|
|
207
|
+
power column. The list is sorted by CPU usage by default; press `s` to cycle
|
|
208
|
+
through CPU → MEM → GPU → PID → NAME → USER, and `↑` / `↓` to scroll. The
|
|
209
|
+
header shows the current sort column and direction. Press `Space` to pause the
|
|
210
|
+
list while you scroll through it; the footer changes to `Space resume` and the
|
|
211
|
+
summary keeps updating. The process table refreshes every 2 seconds (or
|
|
212
|
+
`--interval`, if larger) to keep macpm's own CPU usage low; the summary above
|
|
213
|
+
it refreshes every interval. macpm's own process is listed as `macpm`.
|
|
214
|
+
|
|
215
|
+
Per-process CPU and memory come from `psutil`, with `/bin/ps` for processes
|
|
216
|
+
owned by other users (so system processes such as WindowServer appear too).
|
|
217
|
+
GPU usage is the GPU time of the process' `IOAccelerator` user clients;
|
|
218
|
+
processes without a readable GPU client show `0.0`.
|
|
219
|
+
|
|
220
|
+
## Network view
|
|
221
|
+
|
|
222
|
+
Press `4` for a network overview built from `nettop`. The summary box shows
|
|
223
|
+
the TCP socket count per state (`ESTABLISHED`, `LISTEN`, `CLOSE_WAIT`,
|
|
224
|
+
`TIME_WAIT`), the UDP socket count and the current interface throughput. Below
|
|
225
|
+
it the traffic table lists the busiest processes with their socket count and
|
|
226
|
+
per-process download/upload rate, and the listening table lists every TCP
|
|
227
|
+
listening socket with its bind address, PID and process. The traffic table is
|
|
228
|
+
sorted by download rate (`↓/s`) by default. `Tab` moves the focus between the
|
|
229
|
+
two tables, `s` cycles the sort column of the focused table (download, upload,
|
|
230
|
+
connections, PID, name), `↑` / `↓` scroll it and `Space` pauses sampling. The
|
|
231
|
+
two tables are shown side by side on terminals at least 110 columns wide and
|
|
232
|
+
stacked otherwise; the listening table is hidden when the terminal is narrower
|
|
233
|
+
than 60 columns or too short for two panes.
|
|
234
|
+
|
|
235
|
+
Per-process rates are the difference between the cumulative byte counters that
|
|
236
|
+
`nettop` reports; the first sample after entering the view is the baseline. The
|
|
237
|
+
traffic table refreshes every 2 seconds from a per-process snapshot, the
|
|
238
|
+
socket/listening data every 5 seconds from a full snapshot. Both only run
|
|
239
|
+
while the view is open.
|
|
240
|
+
|
|
241
|
+
The network view's summary box has a line with the active IPv4 interface and
|
|
242
|
+
prefix, the default gateway, and the public IP with its city. View 1 shows the
|
|
243
|
+
same line in a spare row of the Processor box when there is one; the per-core
|
|
244
|
+
view leaves that row empty. For example:
|
|
245
|
+
|
|
246
|
+
```text
|
|
247
|
+
┌ Network ─────────────────────────────────────────────────────────────────────┐
|
|
248
|
+
│ en0 192.168.1.23/24 · gw 192.168.1.1 · 203.0.113.45 Nanning, CN Unicom │
|
|
249
|
+
│ TCP 115 EST 61 LISTEN 27 CLOSE_WAIT 25 TIME_WAIT 1 UDP 70 │
|
|
250
|
+
│ ↓ 11K/s ↑ 4.0K/s sockets 185 processes 39 │
|
|
251
|
+
└──────────────────────────────────────────────────────────────────────────────┘
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The local values come from `psutil` and `route -n get default` and refresh
|
|
255
|
+
every 30 seconds while the default or network view is open. The public values
|
|
256
|
+
come from a background HTTPS request to `ipinfo.io`, falling back to
|
|
257
|
+
`ipwho.is`; for a Chinese address the carrier abbreviation (Telecom, Unicom,
|
|
258
|
+
Mobile) is appended after the country code, e.g. `Shanghai, CN Telecom`. A successful answer is cached
|
|
259
|
+
for 10 minutes and a failed one is retried after a minute. The lookup starts when a view that shows the line is
|
|
260
|
+
first drawn — the default view at startup, or the network view — and it
|
|
261
|
+
necessarily reveals your public IP to the service; pass `--no-public-ip` to
|
|
262
|
+
disable it. On a narrow terminal the line is clipped with an ellipsis. This
|
|
263
|
+
lookup is the only network request macpm makes.
|
|
264
|
+
|
|
265
|
+
`nettop` runs without root and, unlike `lsof -i`, sees sockets owned by other
|
|
266
|
+
users, so root daemons such as `launchd` and `mDNSResponder` appear in the
|
|
267
|
+
listening table. Three limitations follow from the data source:
|
|
268
|
+
|
|
269
|
+
- `nettop` does not report sockets without an owning process (typically
|
|
270
|
+
`TIME_WAIT`), so the total is lower than a raw `netstat -an` count;
|
|
271
|
+
`ESTABLISHED`, `LISTEN` and `CLOSE_WAIT` match.
|
|
272
|
+
- Byte counters include loopback traffic, so the sum of per-process rates can
|
|
273
|
+
be higher than the interface total in the summary.
|
|
274
|
+
- Process names are truncated to about 15 characters, the same `comm` limit
|
|
275
|
+
shown in the process view.
|
|
276
|
+
|
|
277
|
+
## Compatibility
|
|
278
|
+
|
|
279
|
+
Tested on macOS 27.2 with an M3 Max. Behaviour depends more on the chip
|
|
280
|
+
generation than on the macOS version:
|
|
281
|
+
|
|
282
|
+
| Environment | Status |
|
|
283
|
+
|---|---|
|
|
284
|
+
| macOS 12–15, M1–M4 | Works |
|
|
285
|
+
| macOS 26, M1–M4 | Likely works |
|
|
286
|
+
| macOS 26, M5 / M5 Pro / Max | Partial: new CPU tier/channel names (`MCPU`/`SCPU`) and `acc-clusters` DVFS data are not fully handled |
|
|
287
|
+
| macOS 15/26, M1/M2 Ultra | Needs verification: multi-die complex channels may be `ECPU0/1` |
|
|
288
|
+
| macOS 27 | Works on the tested M3 Max; some 27 builds restrict unprivileged `Energy Model` refreshes |
|
|
289
|
+
| Intel Macs | Not supported; the Apple-Silicon IOReport groups are absent |
|
|
290
|
+
|
|
291
|
+
## Standalone binaries
|
|
292
|
+
|
|
293
|
+
Standalone unsigned/ad-hoc arm64 binary (`macpm`) can be built with
|
|
294
|
+
`packaging/build.sh` and attached to a GitHub release. It bundles Python and
|
|
295
|
+
all dependencies, so the target Mac needs no Python installation.
|
|
296
|
+
|
|
297
|
+
On first launch from a browser download, macOS Gatekeeper may ask you to
|
|
298
|
+
right-click → Open, or you can remove the quarantine flag:
|
|
299
|
+
|
|
300
|
+
```sh
|
|
301
|
+
xattr -d com.apple.quarantine ./macpm ./macpm.command
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
See [packaging/README.txt](https://github.com/visualcjy/macpm/blob/main/packaging/README.txt) for details.
|
|
305
|
+
|
|
306
|
+
## Development
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
git clone https://github.com/visualcjy/macpm.git
|
|
310
|
+
cd macpm
|
|
311
|
+
python3 -m venv .venv
|
|
312
|
+
. .venv/bin/activate
|
|
313
|
+
python3 -m pip install -e .
|
|
314
|
+
python3 -m unittest discover -s tests -v
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Build source and wheel distributions:
|
|
318
|
+
|
|
319
|
+
```sh
|
|
320
|
+
python3 -m pip install build twine
|
|
321
|
+
python3 -m build
|
|
322
|
+
python3 -m twine check dist/*
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Build standalone arm64 binaries (build machine needs Python + PyInstaller +
|
|
326
|
+
runtime dependencies; the output has no Python dependency):
|
|
327
|
+
|
|
328
|
+
```sh
|
|
329
|
+
PYTHON=python3 packaging/build.sh
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Release steps are documented in [RELEASE.md](https://github.com/visualcjy/macpm/blob/main/RELEASE.md).
|
|
333
|
+
|
|
334
|
+
## Troubleshooting
|
|
335
|
+
|
|
336
|
+
- **`macpm: command not found`** — add your Python user-base `bin` directory to
|
|
337
|
+
`PATH`, or run `python3 -m macpm`.
|
|
338
|
+
- **Power readings freeze or show `n/a` on macOS 27** — some builds restrict
|
|
339
|
+
unprivileged `Energy Model` refreshes. CPU/GPU usage and frequency still
|
|
340
|
+
work; a counter that never reports is shown as `n/a` instead of `0.00W`.
|
|
341
|
+
Run `macpm-dump` to inspect the raw values.
|
|
342
|
+
- **M5/Ultra values look wrong** — CPU tier/channel mapping is not complete;
|
|
343
|
+
see the compatibility table.
|
|
344
|
+
- **The Temps & Fans box says `SMC unavailable`** — the AppleSMC user client
|
|
345
|
+
could not be opened on this macOS build; the rest of macpm still works.
|
|
346
|
+
- **A temperature shows `--`** — not every SMC key exists on every chip; the
|
|
347
|
+
reader only reports the keys that are present.
|
|
348
|
+
- **The network view says `nettop unavailable`** — `/usr/bin/nettop` is
|
|
349
|
+
missing or could not run. The other views keep working.
|
|
350
|
+
- **The network header has no public IP** — the lookup is disabled with
|
|
351
|
+
`--no-public-ip`, or the machine is offline / the service is blocked. The
|
|
352
|
+
local IP, prefix and gateway still show.
|
|
353
|
+
|
|
354
|
+
## Changelog
|
|
355
|
+
|
|
356
|
+
See [CHANGELOG.md](https://github.com/visualcjy/macpm/blob/main/CHANGELOG.md). The 2.0 release removes the dependency on
|
|
357
|
+
`sudo`, `powermetrics` and temporary files.
|
|
358
|
+
|
|
359
|
+
## Credits
|
|
360
|
+
|
|
361
|
+
- [asitop](https://github.com/tlkh/asitop) — original Python TUI this project
|
|
362
|
+
was forked from
|
|
363
|
+
- [macmon](https://github.com/vladkens/macmon) and
|
|
364
|
+
[Stats](https://github.com/exelban/stats) — IOReport/SMC reference
|
|
365
|
+
implementations
|
|
366
|
+
- The IOReport sample-delta and DVFS-table ideas follow those projects
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
MIT. See [LICENSE](https://github.com/visualcjy/macpm/blob/main/LICENSE).
|