build(macos): inline homebrew deps in setup script, drop px4-dev meta-formula

Homebrew 4.5 (April 2026) stopped auto-tapping cross-tap
dependencies declared in formulae, as a security + performance
change. The px4-dev meta-formula pulled in packages from
osx-cross/arm, PX4/px4, and discoteq/discoteq, so 'brew install
px4-dev' now aborts before any real work unless every tap has been
added explicitly. On macos-latest CI runners the chain broke at the
first unreachable dep (discoteq/discoteq/flock) and subsequent make
steps failed with 'ccache: command not found'.

Since Tools/setup/macos.sh is the canonical install path and already
tapped osx-cross/arm and PX4/px4 before calling brew install, the
simplest fix is to inline the package list and call brew install
directly. The px4-dev meta-formula will be kept upstream as a
deprecated no-op so older copies of macos.sh on long-lived branches
and cached Docker images keep working.

The inlined package list is the same set px4-dev depended on, minus
the dead-weight flock dependency that hadn't been invoked in the PX4
build since the NuttX 9.1.x era. See the accompanying PX4/homebrew-px4
PR for formula changes.

Docs updated to match: docs/en/dev_setup/dev_env_mac.md no longer
names the px4-dev formula, describes the package list directly.

Verified locally on macOS ARM64:
- ./Tools/setup/macos.sh runs to completion with both taps and all 13
  packages resolving correctly
- make distclean && make px4_fmu-v6x_default builds successfully
  (1250/1250 ninja steps, 1930096 B FLASH used)

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
Ramon Roche
2026-04-18 12:50:28 -07:00
parent 32398d6abf
commit a6d1822521
2 changed files with 34 additions and 22 deletions
+33 -21
View File
@@ -40,32 +40,44 @@ then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
fi
# Install px4-dev formula
# Required taps. Homebrew 4.5+ no longer auto-resolves cross-tap
# dependencies, so every tap that a package lives in must be added
# explicitly here before `brew install`.
#
# - osx-cross/arm: arm-gcc-bin@13 (ARM cross-compiler)
# - PX4/px4: fastdds, genromfs, kconfig-frontends (PX4-specific)
brew tap osx-cross/arm
brew tap PX4/px4
# Package list. This replaces the px4-dev meta-formula, which is kept
# as a deprecated no-op upstream. See PX4/homebrew-px4 for history.
PX4_BREW_PACKAGES=(
ant
astyle
bash-completion
ccache
cmake
fastdds
genromfs
kconfig-frontends
ncurses
ninja
osx-cross/arm/arm-gcc-bin@13
python
python-tk
)
if [[ $REINSTALL_FORMULAS == "--reinstall" ]]; then
echo "[macos.sh] Re-installing dependencies (homebrew px4-dev)"
# confirm Homebrew installed correctly
echo "[macos.sh] Re-installing PX4 toolchain dependencies"
brew doctor
brew tap osx-cross/arm
brew tap PX4/px4
brew reinstall px4-dev
brew link --overwrite --force arm-gcc-bin@13
brew reinstall "${PX4_BREW_PACKAGES[@]}"
else
if brew ls --versions px4-dev > /dev/null; then
echo "[macos.sh] px4-dev already installed"
else
echo "[macos.sh] Installing general dependencies (homebrew px4-dev)"
brew tap osx-cross/arm
brew tap PX4/px4
brew install px4-dev
brew link --overwrite --force arm-gcc-bin@13
fi
echo "[macos.sh] Installing PX4 toolchain dependencies"
brew install "${PX4_BREW_PACKAGES[@]}"
fi
brew link --overwrite --force arm-gcc-bin@13
# Python dependencies
echo "[macos.sh] Installing Python3 dependencies"
# We need to have future to install pymavlink later.
+1 -1
View File
@@ -59,7 +59,7 @@ To build for [other targets](../dev_setup/dev_env.md#supported-targets) you will
```
This installs:
- **`px4-dev`** — ARM cross-compiler (`arm-gcc-bin@13`), `cmake`, `ninja`, `ccache`, and other build tools
- **Toolchain packages** from the `osx-cross/arm` and `PX4/px4` Homebrew taps — ARM cross-compiler (`arm-gcc-bin@13`), `cmake`, `ninja`, `ccache`, `fastdds`, `genromfs`, `kconfig-frontends`, and other build tools
- **Python packages** from `requirements.txt`
- **`px4-sim`** (via `--sim-tools`) — Gazebo Harmonic simulation (`gz-harmonic`) and related tools