Skip to content

Conversation

@samuelarogbonlo
Copy link

@samuelarogbonlo samuelarogbonlo commented Mar 31, 2025

Skip bottle relocation on Apple Silicon with default prefix

This PR skips the relocation process for bottles on Apple Silicon Macs when using the default prefix (/opt/homebrew), as it's unnecessary when the prefix is unique.

Benefits

  • Faster bottle pouring on Apple Silicon
  • Enables code-signing of homebrew-core packages
  • Improves security by avoiding binary modification post-build

Implementation

  • Added environment variable (HOMEBREW_BOTTLE_SKIP_RELOCATION_ARM64) for gradual rollout
  • Implemented binary file relocation detection using RubyMacho
  • Added tracking of relocation status in bottle tab metadata
  • Only skips relocation when truly unnecessary

Note: Due to platform differences between Apple Silicon and Linux, autogenerated completion files will need to be updated in CI.

Fixes #19247

samuelarogbonlo and others added 30 commits February 26, 2025 13:17
This change skips the relocation process for bottles on Apple Silicon Macs
when using the default prefix (/opt/homebrew). Relocation was initially
needed for Intel Macs to avoid wide-reaching replacements with false positives,
but is unnecessary for Apple Silicon where the default prefix is unique.

Benefits:
- Simplifies and speeds up bottle pouring on Apple Silicon
- Potentially enables code-signing of homebrew-core packages
- Improves security by avoiding binary modification post-build

A --force-bottle-relocation flag is added for edge cases where
relocation might still be needed.

Fixes Homebrew#19247
1. Add binary relocation detection using RubyMacho
2. Update skip_relocation_for_apple_silicon? to consider binary analysis
3. Track relocation status in bottle tab metadata
4. Update keg relocation methods to use new functionality

This implements the remaining suggestions from issue Homebrew#19247.
@samuelarogbonlo samuelarogbonlo changed the title Add --as-dependency and --ask options to brew install and reinstall Skip bottle relocation on Apple Silicon with default prefix Mar 31, 2025
@samuelarogbonlo samuelarogbonlo deleted the add-options branch March 31, 2025 23:04
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.

Don't relocate Apple Silicon bottles for default prefix

1 participant