Skip to main content

macpmd

A process manager for macOS and Linux — a PM2 equivalent using launchd or systemd for persistence and crash recovery.

macpmd makes it easy to manage long-running processes. Start, stop, restart, and monitor processes from the command line. Processes are automatically registered with the system service manager (launchd on macOS, systemd on Linux) so they survive reboots and recover from crashes.

Features

  • Process management — add, start, stop, restart, and delete processes
  • Batch operations — operate on multiple processes at once, or use --all
  • Process listing — view all processes with status, PID, uptime, restart count, and service state
  • Log management — stdout/stderr redirected to ~/.local/share/macpmd/logs/ with automatic rotation
  • Log tailing — view recent output, follow in real-time, or show all process logs with coloured prefixes
  • Exit code logging — process exit codes and signals are recorded in the log
  • Service integration — launchd plists (macOS) or systemd units (Linux) auto-installed for boot persistence and crash recovery
  • Sudo support — start processes with --sudo for elevated privileges
  • Zero dependencies — stdlib only, no external packages required
  • Coloured output — TTY-aware ANSI colours for status display

Requirements

  • Python 3.12+
  • macOS (launchd) or Linux (systemd)

Installation

pip install macpmd

Or run directly with uv:

uvx macpmd

Quick Start

# Add a process (name auto-derived as "server")
macpmd add "node server.js"

# Add with an explicit name
macpmd add "python3 worker.py" --name my-worker

# Add with sudo
macpmd add "python3 server.py" --name my-app --sudo

# List all processes
macpmd list

# View logs
macpmd logs my-app
macpmd logs my-app --follow
macpmd logs --all
macpmd logs --all --follow

# Start a stopped process
macpmd start my-app

# Start all stopped processes
macpmd start --all

# Restart a process
macpmd restart my-app

# Stop multiple processes
macpmd stop my-app worker

# Stop all processes
macpmd stop --all

# Remove a process entirely
macpmd delete my-app

How It Works

macpmd spawns processes in new sessions (start_new_session) so they survive the parent terminal closing. Process state is tracked in ~/.local/share/macpmd/state.json and logs are written to ~/.local/share/macpmd/logs/<name>.log.

When you add a process, a service file is automatically installed:

macOS (launchd)

A plist is installed in ~/Library/LaunchAgents/ (or /Library/LaunchDaemons/ for --sudo) with:

  • KeepAlive: true — launchd restarts the process if it crashes
  • RunAtLoad: true — the process starts automatically at login

Linux (systemd)

A unit file is installed in ~/.config/systemd/user/ (or /etc/systemd/system/ for --sudo) with:

  • Restart=always — systemd restarts the process if it crashes
  • WantedBy=default.target — the process starts automatically at login

This gives you PM2-style process management backed by your platform's native process supervisor.

Development

# Set up development environment
make dev

# Run linting and type checking
make check

# Auto-format code
make format

# Build wheel and docs
make build

Licence

Released under the Unlicense — public domain.

Metadata

Release files for macpmd 1.0.2

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

Built distribution (wheel)

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

Release files / macpmd-1.0.2-py3-none-any.whl

Download URL macpmd-1.0.2-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50d1ce636be05eded29bf4fd68e305b3521c223fd3b8fee3b1c61ca126ee00f8
BLAKE2b-256 checksum
How to use checksums
cf6b15d9383c5d2a3b40efe675b737f91b9cf21bab54b5267f3adfd47889253b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for macpmd 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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