Skip to content

Formula post-install fails when building from source from API with HOMEBREW_FORBID_PACKAGES_FROM_PATHS set #20984

@ZhongRuoyu

Description

@ZhongRuoyu

brew doctor output

Your system is ready to brew.

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • My "brew doctor output" above says Your system is ready to brew or a definitely unrelated Tier message.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 4.6.20-30-gd772896
ORIGIN: https://github.com/Homebrew/brew
HEAD: d7728966873a65a8d6fbec99890c58837d13cfc4
Last commit: 2 hours ago
Branch: main
Core tap JSON: 05 Nov 19:47 UTC
Core cask tap JSON: 05 Nov 19:47 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DOWNLOAD_CONCURRENCY: 16
HOMEBREW_EDITOR: vim
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.4.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/bin/ruby
CPU: octa-core 64-bit dunno
Clang: 17.0.0 build 1700
Git: 2.50.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.0.1-arm64
CLT: 26.0.0.0.1.1757719676
Xcode: 26.0
Rosetta 2: false

What were you trying to do (and why)?

This issue is filed for https://github.com/orgs/Homebrew/discussions/6512 (CC @rami3l).

Running brew install --build-from-source rustup.

The problem can be reproduced with --HEAD too; the formula just needs to be built from source.

What happened (include all command output)?

$ brew install -svd rustup      
==> Fetching downloads for: rustup
✔︎ API Source rustup.rb
✔︎ Formula rustup (1.28.2)
/opt/homebrew/Library/Homebrew/build.rb (Formulary::FromPathLoader): loading /Users/ruoyu/Library/Caches/Homebrew/api-source/Homebrew/homebrew-core/7e49f949195479ced5ab855bd6fa95f0e39fc24e/Formula/rustup.rb
[snip]
==> Cleaning
==> Finishing up
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall rustup
Warning: Removed Sorbet lines from backtrace!
Rerun with `--verbose` to see the original backtrace
==> Homebrew requires formulae to be in a tap, rejecting:
  /Users/ruoyu/Library/Caches/Homebrew/api-source/Homebrew/homebrew-core/7e49f949195479ced5ab855bd6fa95f0e39fc24e/Formula/rustup.rb (/Users/ruoyu/Library/Caches/Homebrew/downloads/473a2db91b1c1cb9434f66652c74dc4189845670b59ac2bfa0a861ed9c9cb6cc--rustup.rb)

To create a tap, run e.g.
  brew tap-new <user|org>/<repository>
To create a formula in a tap run e.g.
  brew create <url> --tap=<user|org>/<repository>

/opt/homebrew/Library/Homebrew/utils/path.rb:38:in 'Utils::Path.loadable_package_path?'
/opt/homebrew/Library/Homebrew/formulary.rb:739:in 'Formulary::FromPathLoader.try_new'
/opt/homebrew/Library/Homebrew/formulary.rb:1457:in 'block in Formulary.loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:1456:in 'Array#each'
/opt/homebrew/Library/Homebrew/formulary.rb:1456:in 'Formulary.loader_for'
/opt/homebrew/Library/Homebrew/formulary.rb:1167:in 'Formulary.factory'
/opt/homebrew/Library/Homebrew/formula_installer.rb:1332:in 'FormulaInstaller#post_install_formula_path'
/opt/homebrew/Library/Homebrew/formula_installer.rb:1351:in 'FormulaInstaller#post_install'
/opt/homebrew/Library/Homebrew/formula_installer.rb:998:in 'FormulaInstaller#finish'
/opt/homebrew/Library/Homebrew/install.rb:490:in 'Homebrew::Install.install_formula'
/opt/homebrew/Library/Homebrew/install.rb:422:in 'block in Homebrew::Install.install_formulae'
/opt/homebrew/Library/Homebrew/install.rb:419:in 'Array#each'
/opt/homebrew/Library/Homebrew/install.rb:419:in 'Homebrew::Install.install_formulae'
/opt/homebrew/Library/Homebrew/cmd/install.rb:390:in 'Homebrew::Cmd::InstallCmd#run'
/opt/homebrew/Library/Homebrew/brew.rb:101:in '<main>'
==> Caveats
To initialize `rustup`, set a default toolchain:
  rustup default stable

If you have `rust` installed, ensure you have "$(brew --prefix rustup)/bin"
before "$(brew --prefix)/bin" in your $PATH:
  https://rust-lang.github.io/rustup/installation/already-installed-rust.html

rustup is keg-only, which means it was not symlinked into /opt/homebrew,
because it conflicts with rust.

If you need to have rustup first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/rustup/bin:$PATH"' >> ~/.zshrc
==> Summary
🍺  /opt/homebrew/Cellar/rustup/1.28.2: 27 files, 10.9MB, built in 1 minute 22 seconds
==> Running `brew cleanup rustup`...
Disable this behaviour by setting `HOMEBREW_NO_INSTALL_CLEANUP=1`.
Hide these hints with `HOMEBREW_NO_ENV_HINTS=1` (see `man brew`).
==> Caveats
zsh completions have been installed to:
  /opt/homebrew/opt/rustup/share/zsh/site-functions

What did you expect to happen?

The formula's post-install step should be successfully run.

Step-by-step reproduction instructions (by running brew commands)

HOMEBREW_FORBID_PACKAGES_FROM_PATHS=1 brew install -svd rustup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions