npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mactrace

v0.1.0

Published

strace for macOS - trace system calls using Instruments

Readme

mactrace

strace for macOS - trace system calls of any process using Instruments.

$ mactrace ls
 0.262    5.75 µs ls/52313          access(0x16b473548, 0) = 0
 0.262    2.25 µs ls/52313          open(0x16b473548, O_RDONLY, 0) = <fd:3>
 0.262    1.25 µs ls/52313          fstat64(<fd:3>, 0x16b472f08) = 0
 0.262     542 ns ls/52313          read(<fd:3>, 0x104e6c000, 4096) = 2293
 0.262     250 ns ls/52313          close(<fd:3>) = 0
 ...

Install

bunx mactrace ls -la

Or install globally:

bun install -g mactrace

Usage

# Basic usage - trace a command
mactrace ls -la

# Save output to file (no colors)
mactrace -o trace.log -- node app.js

# Use -- to separate mactrace flags from command flags
mactrace -- ./my-program --port 3000

# List available trace schemas (debugging)
mactrace --list-schemas -- ls

Output Format

TIMESTAMP  DURATION  PROCESS/PID      SYSCALL(args...) = RESULT
  • Timestamps: seconds since trace start
  • Duration: time spent in syscall
  • File descriptors: shown as <fd:N>
  • Flags: decoded (e.g., O_RDONLY|O_CLOEXEC, PROT_READ|PROT_WRITE)
  • Errors: shown in red with errno (e.g., = -1 ENOENT no such file or directory)

Examples

Trace a Node.js app

mactrace -- node server.js

Trace with output to file

mactrace -o trace.log -- python script.py

Find what files a program opens

mactrace ./myapp 2>&1 | grep open

Debug a hanging process

mactrace -- ./hanging-program
# See which syscall it's stuck on

How It Works

mactrace uses macOS Instruments under the hood:

  1. Runs xcrun xctrace record --template "System Trace" to capture syscalls
  2. Parses the .trace bundle's XML export
  3. Formats output similar to Linux's strace/perf trace

This gives you syscall tracing without needing to disable SIP or use dtrace directly.

Requirements

  • macOS (uses Instruments/xctrace)
  • Bun runtime
  • Xcode Command Line Tools (xcode-select --install)

Limitations

  • No file paths in arguments: System Trace captures register values (pointers), not dereferenced strings. You'll see memory addresses instead of actual paths. For file paths, use fs_usage or dtrace.
  • macOS only: Uses Instruments which is macOS-specific.
  • Requires Instruments: Part of Xcode Command Line Tools.

Comparison with Other Tools

| Tool | Pros | Cons | |------|------|------| | mactrace | Easy to use, no SIP disable, colored output, flag decoding | No file path strings | | dtruss | Shows file paths | Requires SIP disabled, dated | | fs_usage | Real-time, shows paths | Limited to file operations | | dtrace | Most powerful | Complex, requires SIP disabled | | Instruments.app | GUI, comprehensive | Heavy, not scriptable |

License

MIT