Professional Hardware Diagnostics, Multi-Drive Benchmarking & AI Silicon Performance Suite for macOS
High-precision hardware telemetry, physical drive I/O benchmarking, and Apple Silicon / Intel compute stress testing unified into a single standalone tool.
Engineered by samuraidev β’ Portfolio
Key Capabilities β’ Architecture β’ CLI & Interactive Usage β’ Storage Engine β’ Power Subsystem β’ AI Benchmarks
macOS-Hardware-info.py delivers unified, low-level diagnostics and scientific hardware telemetry across Intel (T2) and Apple Silicon (M1/M2/M3/M4) architectures:
- Modular Diagnostic Architecture β Interactive console menu with 5 targeted workflows and dedicated CLI flags for headless automation.
- Comprehensive Storage Diagnostics & Speed Testing β S.M.A.R.T. health, TBW tracking, and unbuffered parallel I/O speed measurement for internal SSDs and external drives (USB-C, Thunderbolt, UASP).
- Dual-Layer Battery & Power Telemetry β Full parity with official macOS Battery Health Management (BHM) paired with raw IOKit electrochemical data (design mAh, nominal capacity, cycles, cell temperature, and voltage).
- AI Silicon Stress Testing β Real hardware compute benchmarks across CPU (FP32 GFLOPS via BLAS), GPU (FP16 TOPS via PyTorch Metal MPS), and Apple Neural Engine (FP16/INT8 TOPS via CoreML).
- Logic Board & Bus Integrity Audit β Live status checks for Camera, Audio, Secure Enclave (Touch ID), Bluetooth, SMC thermal pressure, Fan RPM, Kernel Panic logs, and I2C/SPI bus mining.
The diagnostic engine is organized into decoupled, independent suites designed for single-responsibility execution:
macOS-Hardware-info.py
β
βββ [Data Models & Protocols]
β βββ DiskInfo β Hardware metadata & location descriptors
β βββ SmartReport β S.M.A.R.T. metrics, TBW & thermal telemetry
β βββ BenchmarkResults β Computational throughput & hardware specs
β
βββ [Suite 1: AI & Compute Benchmarks]
β βββ benchmark_cpu() β High-intensity FP32 matrix multiplication (GFLOPS)
β βββ benchmark_gpu() β FP16 Tensor GEMM via PyTorch MPS (TOPS)
β βββ benchmark_npu() β CoreML Neural Engine MLProgram stress test (TOPS)
β
βββ [Suite 2: Storage & Multi-Drive Engine]
β βββ find_physical_disks() β Physical drive enumeration (diskutil & plistlib)
β βββ get_disk_mount_point()β Dynamic writable mount point resolution (/Volumes/...)
β βββ get_smart_data() β Multi-protocol SMART probe (NVMe, SATA, Bridge descriptors)
β βββ benchmark_disk_speed()β Multi-threaded unbuffered I/O benchmark (fcntl.F_NOCACHE)
β
βββ [Suite 3: Logic Board & Peripheral Audit]
β βββ check_logic_board_health() β BHM official health, IOKit mAh, SMC & Panics
β βββ check_peripherals_and_buses() β Camera, Audio, Touch ID, Bluetooth & Bus logs
β
βββ [Execution Orchestrator]
βββ select_execution_option() β Interactive console selector
βββ parse_arguments() β CLI argument parser (argparse)
βββ save_report_file() β Automated persistent .txt log generation
The tool requires sudo privileges to communicate with IOKit, smartctl, powermetrics, and raw block storage descriptors.
# Execute with administrative privileges
sudo python3 macOS-Hardware-info.pyWhen launched without arguments, the script presents an interactive menu:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
macOS HARDWARE INFO - Complete Hardware Diagnostics
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Select diagnostic suite to execute:
[1] π Run All Tests (Full Suite + Persistent .txt Report Generation)
[2] π§ Performance Benchmarks (CPU, GPU & AI with PyTorch)
[3] πΎ Storage Diagnostics (Internal & External SSDs/HDDs)
[4] π¬ Hardware Diagnostics (Logic Board, Peripherals & Buses)
[5] β Exit
For headless execution or script automation, specific flags bypass the interactive menu:
| Flag | Long Argument | Description |
|---|---|---|
-a |
--all |
Executes all test suites and generates {Mac_Model_Serial}.txt report |
-i |
--ai |
Runs CPU, GPU, and NPU performance benchmarks |
-d |
--disks |
Runs internal and external storage S.M.A.R.T. and I/O speed benchmarks |
-w |
--hardware |
Runs Logic Board health, peripheral presence, and bus communication audit |
-h |
--help |
Displays command-line help and usage options |
# Examples:
sudo python3 macOS-Hardware-info.py --disks
sudo python3 macOS-Hardware-info.py --ai
sudo python3 macOS-Hardware-info.py --allThe storage engine automatically detects and classifies both internal and external storage media (Apple Fabric NVMe, PCIe SSDs, SATA drives, USB 3.2, and Thunderbolt enclosures):
- Physical Node Discovery: Uses
diskutil list -plistto parse all physical device nodes (/dev/disk0,/dev/disk1, etc.) independently of synthesized APFS containers. - Dynamic Mount Point Resolution: Resolves active writable mount paths (
/Volumes/DriveName) across partitioned and unpartitioned volumes for secondary and external drives. - Multi-Probe S.M.A.R.T. Ingestion: Automatically attempts communication across NVMe, ATA/SATA, and SCSI translation bridge layers (
-d sat,-d sntasmedia,-d sntrealtek,-d sntjmicron). - Darwin Bridge Awareness: Accurately identifies USB mass storage limitations in macOS, displaying clear diagnostic status when hardware bridge pass-through is restricted by the operating system kernel.
Measures physical drive throughput while bypassing macOS Unified Memory caching:
[ Application Buffer (16 MB Chunks) ]
β
ββββββββββββββββ΄βββββββββββββββ
βΌ (Parallel ThreadPool Workers)βΌ
Worker 1 Worker 2 Worker 3 Worker 4 ... Worker 8
β β β β
ββββββββββββββββ¬βββββββββββββββ
β
fcntl.F_NOCACHE Bypass
β
[ Unified RAM (ARC) ] ββ (Bypassed)
β
[ Physical NAND / Bus ]
- Cache Bypass (
fcntl.F_NOCACHE): Prevents macOS Unified Memory (ARC) from caching benchmark payload blocks, ensuring direct NAND read/write measurement. - High Queue Depth Simulation: Spawns 8 concurrent worker threads via
ThreadPoolExecutorwith 16 MB chunk sizes to saturate PCIe 4.0/5.0 and high-speed USB-C buses. - Entropy Protection: Employs pseudo-random data streams (
os.urandom) to prevent hardware controller compression engines from artificially inflating throughput metrics.
The power diagnostic module features a dual-layer architecture combining certified system metrics with low-level electrochemical data:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β macOS Power Diagnostic Engine β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ€
β Layer 1: Official BHM β Layer 2: IOKit Hardware β
β (SPPowerDataType XML) β (AppleSmartBattery Plist) β
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ€
β β’ Maximum Capacity (98%) β β’ Design Capacity (8579 mAh)β
β β’ Health Condition (Normal) β β’ Nominal Charge (8305 mAh) β
β β’ Calibrated System Level β β’ Raw Max Charge (8061 mAh) β
β β β’ Cycle Count & Voltage β
β β β’ Real-time Cell Temp (Β°C) β
βββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββ
- Official Battery Health Management (BHM): Retrieves certified maximum capacity percentages matching Apple System Settings 1:1 via structured XML parsing.
- Electrochemical IOKit Registry: Extracts factory design capacity (
DesignCapacity), temperature-compensated nominal capacity (NominalChargeCapacity), instantaneous fuel gauge registers (AppleRawMaxCapacity), cycle counts, cell voltage, and thermistor readings.
Designed to measure true compute roofline limits across all execution units on Apple Silicon and Intel hardware:
| Target | Framework / Engine | Workload | Metric |
|---|---|---|---|
| CPU | NumPy (Apple Accelerate BLAS) | 2048Γ2048 FP32 Matrix Multiplication | GFLOPS (FP32) |
| GPU | PyTorch (Metal Performance Shaders) | 4096Γ4096 FP16 Tensor GEMM | TOPS (FP16) |
| NPU | CoreML (Apple Neural Engine) | 5-layer Deep Convolutional Network | TOPS (FP16 & INT8) |
-
Deterministic Hardware Stress: GEMM (General Matrix Multiply) operations maintain an arithmetic intensity
$> 1300\text{ FLOPs/Byte}$ , ensuring benchmarks remain compute-bound without memory-bandwidth throttling. -
Apple Silicon Metal Acceleration: Directly utilizes
torch.mpswith hardware synchronization barriers (torch.mps.synchronize()) for consistent throughput measurement.
| Requirement | Supported Versions | Verification |
|---|---|---|
| macOS | 11.0+ (Big Sur to Sequoia) | sw_vers |
| Python | 3.10 or 3.11 | python3 --version |
| System Tool | smartmontools |
smartctl --version |
# 1. Clone repository
git clone https://github.com/CodeGeekR/macOS-hardware-info.git
cd macOS-hardware-info
# 2. Install system dependency
brew install smartmontools
# 3. Create virtual environment
python3.11 -m venv venv
source venv/bin/activate
# 4. Install Python dependencies
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
# 5. Run diagnostics suite
sudo python3 macOS-Hardware-info.pyDistributed under the MIT License. See LICENSE for details.
Copyright (c) 2024 samuraidev
Author: samuraidev
Portfolio: arquitectodesoftware.co