Homebrew atomic install ↔ default prefix migration: resolving binary path issues
0 reputation · 01 Oct 2021, 17:10 UTC
Goal
We want to upgrade a small, running application that relies on Homebrew‑installed formulae without stopping the service. Homebrew’s atomic install swaps a staged directory into place, so the process can continue to use the old files until the swap occurs.
Constraints
The application’s startup scripts reference binaries under the Homebrew prefix. On Intel macOS the default is /usr/local, while on Apple‑silicon it is /opt/homebrew. A migration script that hard‑codes one path will break on the other architecture. Additionally, some formulae are only available as source builds on Apple‑silicon, potentially delaying the atomic swap.
Unresolved Decision
There is no standard way to declare a single, architecture‑agnostic prefix for scripts that will run on both Intel and Apple‑silicon machines. The Homebrew community has not settled on a unified approach, leaving portability questions open.
Questions
- What strategy can detect the current Homebrew prefix at runtime and adjust binary paths accordingly, while still enabling atomic upgrades?
- Should we pin formulae in a
Brewfileto avoid unexpected upgrades during migration, and how does that interact with the prefix difference? - When a formula lacks a native Apple‑silicon binary, can we still achieve zero‑downtime migration by building under Rosetta, or does that inherently introduce a restart?