Skip to content

Install and self-update on Macs without developer tools or Apple's services - #1329

Open
tolgaergin wants to merge 5 commits into
mainfrom
fix/macos-update-local-checks
Open

tolgaergin wants to merge 5 commits into
mainfrom
fix/macos-update-local-checks

Conversation

@tolgaergin

@tolgaergin tolgaergin commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Standalone lpm self-update in 0.76.0 to 0.88.0 runs /usr/bin/stapler. That is an xcrun shim that works only with Xcode, so on a Mac without Xcode, including one with only the Command Line Tools, every update is refused:

✗ Self-update refused
  reason macOS notarization-ticket validation failed with status exit status: 1: xcode-select: error: tool 'stapler' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

install.sh runs xcrun stapler and fails the same way on a Mac without any developer tools. CI never saw it, because every hosted macOS runner has Xcode.

This replaces #1325. That PR checked the ticket against Apple's ticket service directly, which kept the updater dependent on an undocumented Apple web API. Every installed copy would carry that dependency forever. If Apple changed the API, or a network blocked it, every installed copy would refuse updates again, and its shell parser already answered differently on macOS 15 and macOS 27.

Change

Client checks in install.sh and lpm self-update use only tools that ship with every Mac and call no Apple service:

  • Sigstore provenance (self-update) and SHA-256, plus cosign when present (installer), as before.
  • codesign --verify --strict -R with LPM's pinned requirement. It requires a Developer ID Application signature from team 823S8YKMRW on dev.lpm.cli, and notarized, which the stapled ticket satisfies offline.
  • Bundle inventory, signing identity, the shared keychain group entitlement and the provisioning profile, as before. The profile is now decoded in process (Security.framework CMSDecoder) or with openssl smime, instead of with security cms, which needs a default keychain.
  • The staged copy must have the code and stapled ticket of the validated download, and the new binary must report the expected version.
  • Removed: stapler/xcrun, spctl and Apple's ticket service. Validation tools run with a cleared environment.

Touch ID prompts and LPM Vault access depend on the bundle's signature, entitlement and profile. All of these are still checked, so they are unaffected.

Refused standalone updates name the way forward where the installer can take over (macOS and Linux; Windows has no standalone installer):

Refusal Installer command
The release fails provenance or integrity checks macOS: curl -fsSL https://cli.lpm.dev/install | LPM_INSTALL_CHANNEL=<channel> sh, since the installer checks LPM's Developer ID signature. Linux: the same command plus LPM_INSTALL_REQUIRE_SIGSTORE=1, and the hint says to install cosign first, because without cosign the installer can't tell who published the checksums.
A verified release, or a macOS install outside the installer's app layout, that this updater's checks don't accept the plain command, since the installer applies its current checks
Anything else: location or permission problems, staged files that changed, local staging failures, unsupported platforms, failed replacements none, since reinstalling doesn't fix them. The general help points at the reason instead of claiming verification failed.
✗ Self-update refused
  reason …
  hint Reinstall LPM CLI with the official installer, which verifies the release itself and keeps your settings:
    curl -fsSL https://cli.lpm.dev/install | LPM_INSTALL_CHANNEL=stable sh

--json output puts the command in next_steps[0].command, and error_code stays self_update. The macOS layout refusal no longer links a GitHub page instead of a command.

New workflow: macOS without developer tools. It runs on PRs that touch these paths, and daily. It covers three runners:

Runner Developer tools Apple services
macos-15 none blocked
macos-26 none blocked
macos-15-intel Command Line Tools only reachable

Apple's services are blocked before anything on the runner checks a release, the way a firewall that silently drops their traffic does:

  • The script records what answers first.
  • It pins each host macOS asks about notarization tickets, certificate revocation and Apple's intermediate certificates (api.apple-cloudkit.com, ocsp, ocsp2, crl, valid, certs, www.apple.com) to the addresses DNS gives it. That includes Akamai addresses outside Apple's networks, and a dropped placeholder for any address family DNS gave none in.
  • One pf table drops Apple's networks plus the addresses outside them. Addresses inside Apple's networks are left to the network entries, so the probes show those entries work.
  • It then confirms that each host by name, an address in Apple's IPv4 network and one in its IPv6 network (where the runner has IPv6) no longer open a TCP connection. It goes by curl's count of connections opened, with proxies and ~/.curlrc ignored.

GitHub no longer offers macos-14, so macos-15 is the oldest runner. Install and update steps have a 5-minute limit, so a stall fails fast.

Each runner then does five things:

  1. This build's validation accepts real signed releases.
  2. A fresh install through install.sh.
  3. An in-place upgrade of an affected v0.85.0 install through the installer, with its settings byte-identical afterwards.
  4. The latest stable's own updater is checked. It is expected to fail while that release is 0.88.0 or older; the check flips by itself once a fixed release ships.
  5. This build self-updates to the latest stable and nightly releases.

scripts/ci/test-macos-apple-services.sh tests the blocking script with fakes in the lint job. The release candidate smoke installs with developer tools removed. release.yml still runs stapler validate and spctl on every release.

What this gives up

The client no longer asks Apple during install whether a release's notarization, or LPM's Developer ID certificate, was revoked after publication. spctl checked both. This was agreed before the change. Before installing anything, the client still requires release-workflow provenance (Sigstore), LPM's Developer ID, and codesign's notarized. Checking for revocation moves to the release side, in the next PR in this stack: a daily check with stapler and spctl that Apple still vouches for the current releases' tickets and certificate, and a gate that the previous stable's updater takes each candidate.

CI evidence

On the first push, macos-26 with no developer tools and Apple's services blocked passed every path:

  • the real signed releases validated;
  • a fresh install worked;
  • the v0.85.0 upgrade kept settings byte-identical;
  • the latest stable's canary behaved as expected;
  • this build updated itself to the latest stable and nightly.

Each step took 2 to 9 seconds. macos-15-intel with only the Command Line Tools passed the same paths.

On the second push (804298a), both macos-15 and macos-26 ran with no developer tools and Apple's traffic silently dropped rather than refused. Every path passed again, in 2 to 10 seconds per step, and all six required checks passed.

macOS 11 to 14, which LPM supports, can't run on GitHub's runners, so that remains a residual risk. Apple's published Security source registers a stapled ticket offline from macOS 10.15 on.

Tests

  • Rust: the new guard macos_bundle_validation_runs_only_local_programs_that_ship_with_macos failed on spctl before its removal. The requirement parses and matches install.sh's.
  • Fingerprint and profile: unit tests for the bundle fingerprint and the profile decoder.
  • Real signed archives: signed_macos_release* pass locally with v0.88.0 and v0.87.0.
  • Workflow tests for the three refusal outcomes: no command for a shared-writable directory; the plain command for a macOS install outside the app layout, on both channels; and the per-platform command for a release that fails verification. They check human and JSON output and include snapshots, all offline, and failed before the fix.
  • Unit tests for each platform's recovery mapping.
  • Installer harness: all cases pass on macOS, and under dash on Linux. New cases cover:
    • needing no developer tool, Gatekeeper assessor or Apple service;
    • refusing a bundle that isn't LPM's notarized Developer ID code;
    • the staged-copy checks;
    • decoding the profile whatever OPENSSL_CONF says. With an OpenSSL 3 config, macOS's openssl exits 0 without writing. That's reproduced with the real profile. Mutation-checked: re-adding spctl, dropping -R, dropping notarized and skipping the staged-copy check each fail it.
  • Apple-blocking script: a fake-driven test covers 11 cases, and each of 8 deliberate breakages of the script fails it.
  • Linux (OrbStack, Debian 12 arm64, non-root): all self-update unit and workflow tests pass, as do the harness and the script tests.
  • Local gates:
    • cargo clippy --workspace --all-targets -D warnings: clean.
    • cargo fmt --check: clean.
    • Full nextest gate: 20,042 of 20,042 tests passed, with a current schema copy and none of the session host's GIT_CONFIG_* variables.

Recovery for affected installs

0.76.0 to 0.88.0 standalone installs on Macs without Xcode rerun the installer once. See npm/release/upgrade-recovery.md. The docs update in rust-client-docs merges with the release.

🤖 Generated with Claude Code

…ervices

lpm self-update in 0.76.0 to 0.88.0 runs /usr/bin/stapler, an xcrun shim
that needs Xcode, so standalone installs on Macs without Xcode refuse every
update, and install.sh fails the same way without any developer tools.

The installer and the standalone updater now check a macOS release only with
tools that ship with every Mac, and ask no Apple service: codesign verifies
the signature against LPM's pinned Developer ID requirement, which includes
`notarized` and is satisfied by the stapled ticket offline; the entitlements
and the provisioning profile are checked as before, the profile decoded in
process (or with openssl) instead of with `security cms`, which needs a
default keychain. Gatekeeper's spctl assessment and the stapler check move to
the release side only, where release.yml keeps running them. Validation tools
run with a cleared environment.

A refused standalone update on macOS or Linux now names the installer
command for its channel, in the terminal and in --json next_steps, so a
refusal never leaves anyone without a way forward.

A new workflow removes Xcode and the Command Line Tools from hosted macOS
runners, and on the oldest and newest macOS also blocks Apple's services, then
installs, upgrades an affected v0.85.0 install with its settings kept, and
self-updates this build to the latest stable and nightly releases. It runs
on pull requests that touch these paths and daily.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tolgaergin and others added 4 commits November 25, 2026 03:27
…vices as a dropping firewall does

A refused standalone update named the installer for every refusal, including
provenance and integrity failures. On Linux without cosign the installer
can't tell who published a release's checksums, so it could install what the
updater refused. Now:
- a release that fails verification gets an installer command that requires
  its Sigstore signature on Linux (install cosign first), and a plain one on
  macOS, where the installer checks LPM's Developer ID signature;
- a verified release or macOS layout this updater doesn't accept gets the
  plain command;
- location and permission refusals, staged files that changed and failed
  replacements get none, since reinstalling doesn't fix them.
Every command names its channel. The variant carries its own recovery text.

install.sh decodes the provisioning profile with OPENSSL_CONF unset and
requires output: with an OpenSSL 3 configuration there, macOS's openssl
writes nothing yet exits 0, which failed genuine installs without a word.

The Apple-services block records a reachable baseline first, pins each Apple
host to the addresses DNS gives it, drops all of them and Apple's networks,
probes one address per host and family, and counts only failed connections
as blocked. The oldest blocked runner moves to macos-15, since GitHub no
longer offers macos-14. The cache key is per runner, the path filter covers
the inputs these checks depend on, the install and update steps have a time
limit, and the canary reads --json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ntries on their own

Staging now reports whether the release failed verification or something
local failed: only the manifest, its signature, a missing entry or asset and
the digest are release-verification refusals; a staged file replaced while
being sealed, an unsupported platform and client errors name no installer.
The version probe only runs the binary; the staged-file checks around it
name no installer either. Reasons no longer end with "Install manually"
beside a hint, and the general refusal help points at the reason instead of
claiming verification failed.

The Apple-services block judges a probe by curl's connect time, so a service
that accepts and then stalls still counts as reachable; drops addresses
inside Apple's networks only through the network entries, so probing them
shows those entries work; pins a host to a dropped placeholder for an
address family DNS gave none in; covers certs.apple.com and www.apple.com;
and uses one pf table. The canary keeps stderr out of the JSON it parses,
and the path filter covers the channel and JSON contract modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed assets as the release's

A staged asset that changed while it was probed (Linux) or staged (macOS)
could fail that check first and name the installer. Both now run through
check_staged_asset, which checks the file before and after and lets a
changed file win, so only a failed check of the verified file names one.

The download helper reports an asset larger than this updater accepts
separately from download and staging failures, and staging treats it as
the release's: a future release that outgrows the cap still names the
installer. Tests pin the digest mismatch and size caps as release
verification failures, and local staging failures as local, against the
real signed v0.84.0 release.

The Apple-services probe goes by curl's count of connections opened, with
proxies and ~/.curlrc ignored: macOS's curl can report no connect time for
a service that accepts and stalls in the TLS handshake. The fake firewall
honours the table only through the block rule, and the IPv4 placeholder is
tested. The missing-manifest reason no longer guesses at its cause, and the
canary greps its two output files directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the validated one

A macOS bundle changed after validation, by another process or security
software, could fail the version probe and still name the installer. A
failed probe now validates the bundle again and names the installer only if
its fingerprint is unchanged; a real-release test covers both outcomes.

The size-cap mapping is its own function with a test of both arms. The two
staging tests that use the v0.84.0 release run only where it ships an asset
(not Windows on ARM64 or musl ARM64), and assert the exact failure they
name. The fake curl answers only with -q and --noproxy '*', and the main
firewall case asserts the block rule itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant