Darwin debugging for the Linux developer

These technical notes are meant to explain to a Linux developer what are the equivalents to debug certain things over Darwin.

Key differences from Linux

Linux tool macOS equivalent Purpose
strace dtruss (1), strace-macos System call tracing
perf sample, spindump, Instruments (2) Performance profiling
ss netstat -nv Socket statistics
iostat iostat -Id Disk I/O statistics
lsof lsof Open file listings
/proc vmmap, heap, lsof Process/memory information
blktrace fs_usage -wf filesys Trace real-time IO activity

(1): dtruss is unavailable on systems with System Integrity Protection enabled (SIP). Lix CI machines have SIP enabled.

(2): Instruments is a graphical application that requires a remote desktop and cannot be used over SSH.

Getting flamegraphs out of sample

Combine https://github.com/brc7/flamegraph-sample/blob/master/stackcollapse-sample.py with https://speedscope.app/.

Inspecting memory allocations

heap can give a list of allocations sorted by sizes when it can recognize the type in-memory (doesn't always work for everything).

iostat tips

iostat -Id on macOS will return as the first row the cumulative data SINCE the first boot.

xfrs := IO operations per second.

Listing file descriptors

/proc doesn't exist on macOS, therefore, lsof is the only thing that can list file descriptors and let you understand the relationships.

Tracing network activity

fs_usage -wf network can trace real-time network activity on file descriptors.

Checking Internet quality

networkQuality -v will dump an Apple-infrastructure Internet connection check for bandwidth and latency.


Revision #3
Created 2026-07-22 22:48:34 UTC by Raito Bezarius
Updated 2026-07-22 23:00:18 UTC by Raito Bezarius