machocmp

command
v1.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command machocmp checks that a signed macOS binary (or app bundle) made elsewhere contains exactly the code this repository builds, and nothing but an Apple code signature on top of it.

The release's macOS files are built, signed and notarized in another repository, where the Apple credentials live (see .github/workflows/release.yml). Go builds are reproducible: the same source, Go version and flags give the same bytes on any host. So the release workflow rebuilds the unsigned binaries from the tagged commit and runs this command, which accepts a signed slice only if

  • every byte before the code signature equals the rebuilt slice, apart from the fields codesign rewrites: the LC_CODE_SIGNATURE load command (and the header's command count and size it changes), and the size of the __LINKEDIT segment that holds the signature;
  • nothing follows the signature (but what the rebuild had there);
  • the signature's code directories cover exactly that code, their page hashes match it, it carries no entitlements, and (when asked) the hardened runtime flag, the signing identifier and the Apple team ID are the expected ones.

Whether the signature itself is valid (the certificate chain to Apple and the notarization) is checked by codesign, spctl and stapler on a Mac; this command makes sure that what is signed is our code.

Usage:

machocmp [flags] SIGNED REF [REF...]
    SIGNED is a universal or thin Mach-O; each REF a thin, unsigned (or
    ad-hoc signed) rebuild, one per architecture of SIGNED.
machocmp [flags] -app SIGNED.app REF.app
    every file of the rebuilt bundle must be in the signed one with the
    same bytes, the executables under Contents/MacOS compared as above;
    the signed bundle may add only its signature files.
machocmp -same DIR1 DIR2
    the two trees hold the same files with the same bytes (no symlinks).

Flags: -team ID (Apple team identifier), -id IDENTIFIER (signing identifier), -runtime (require the hardened runtime).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL