Skip to main content

systemd emulation for Darwin - provides systemctl/journalctl on macOS

Project description

dystemctl

systemd emulation for Darwin - provides systemctl and journalctl commands on macOS using launchd.

Installation

Nix (recommended)

# Run directly
nix run github:sielicki/dystemctl#systemctl -- status
nix run github:sielicki/dystemctl#journalctl -- -f

# Install to profile
nix profile install github:sielicki/dystemctl

# Or add to your flake
{
  inputs.dystemctl.url = "github:sielicki/dystemctl";
}
# Then use: inputs.dystemctl.packages.${system}.default

For nix-darwin or home-manager, add the overlay:

{
  nixpkgs.overlays = [ inputs.dystemctl.overlays.default ];
  environment.systemPackages = [ pkgs.dystemctl ];
}

Homebrew

# Add the tap
brew tap sielicki/dystemctl https://github.com/sielicki/dystemctl

# Install
brew install dystemctl

Or install directly from the repository:

brew install --HEAD sielicki/dystemctl/dystemctl

uv/uvx

uv tool install git+https://github.com/sielicki/dystemctl.git

run just once

uvx --from git+https://github.com/sielicki/dystemctl.git systemctl status -n 1 emacs
● homebrew.mxcl.emacs-plus@30 - emacs-plus@30
     Loaded: loaded (/opt/homebrew/Cellar/emacs-plus@30/30.2/homebrew.mxcl.emacs-plus@30.plist; enabled)
     Active: active (running) since Fri 2026-01-23 22:16:43; 1h 32min ago
   Main PID: 72371 (emacs)
     Memory: 424.6M
        CPU: 0.0%
    Trigger: KeepAlive

Jan 23 23:49:22 dogleg emacs[72371]: Cleaning up the recentf list...done (0 removed)

Usage

systemctl commands

# List all services
systemctl status
systemctl list-units

# Manage services
systemctl start <service>
systemctl stop <service>
systemctl restart <service>
systemctl enable <service>
systemctl disable <service>

# Check status
systemctl status <service>
systemctl is-active <service>
systemctl is-enabled <service>

# View service details
systemctl show <service>
systemctl cat <service>

journalctl commands

# View logs
journalctl -u <service>
journalctl -f                    # Follow logs
journalctl --since "1 hour ago"
journalctl -n 100                # Last 100 lines

# Log management
journalctl --disk-usage
journalctl --vacuum-time 7d      # Delete logs older than 7 days
journalctl --vacuum-size 100M    # Keep logs under 100MB

Additional features

# Import a systemd unit file
systemctl import myservice.service

# Export a launchd service to systemd format
systemctl export com.example.myservice -o myservice.service

# Analyze boot performance
systemctl analyze
systemctl analyze blame

# Run a transient service
systemctl run echo "hello world"

# Validate service files
systemctl verify myservice.plist

Service name resolution

dystemctl supports flexible service name resolution:

# All of these work:
systemctl status com.apple.cups.cupsd
systemctl status cupsd
systemctl status cups

Differences from systemd

  • launchd uses on-demand activation rather than explicit dependencies
  • Socket activation uses launchd's native socket support
  • Timer services use StartInterval or StartCalendarInterval
  • Some systemd features (cgroups, namespaces) have no macOS equivalent
  • ???? hundreds more. This is a pretty big hack. But for simple muscle-memory, it's pretty usable. YMMV. ¯\_(ツ)_/¯

Development

# Install dev dependencies
uv sync

# Run tests
uv run pytest

# Run with coverage
uv run pytest --cov=dystemctl

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dystemctl-0.1.1.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dystemctl-0.1.1-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

Details for the file dystemctl-0.1.1.tar.gz.

File metadata

  • Download URL: dystemctl-0.1.1.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dystemctl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e325f297d969fd688943d6d34149d148a5d6a8e2051db1c1384d725fb7bee5e3
MD5 87986a506b9c9dd8f7405d0680574a38
BLAKE2b-256 5f4850be72a862f7974c0e6dd5bec2d86c713b7259e4cefa2f608b7582e65ed8

See more details on using hashes here.

Provenance

The following attestation bundles were made for dystemctl-0.1.1.tar.gz:

Publisher: build.yml on sielicki/dystemctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dystemctl-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: dystemctl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 46.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dystemctl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c7e15190157e8106acddd94d952af7d7085465649fe87a26260bf4836c8e587e
MD5 7eeb7285440f8281e33c2a462c0f2fba
BLAKE2b-256 76e8ceca97db1ae74c462ede42646a19aa099df7befa2b0a6ac4871a1af7d0b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for dystemctl-0.1.1-py3-none-any.whl:

Publisher: build.yml on sielicki/dystemctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page