Maury Markowitz
Maury Markowitz

Reputation: 9283

Homebrew path variable for Xcode

I recently updated HB on both my and my wife's machine. The former is Intel and the later is M1, so the libs are in different places, /opt/homebrew/... vs. /usr/local/... This makes adding the header search a bit annoying in Xcode, and now my builds are failing as it can't find the libs in /opt... on my machine.

I seem to recall there is a shell variable one can use in this situation, not $PATH but another one like $HOMEBREWPATH or similar that is automatically created? I recall seeing it mentioned when I did the install on the M1, but now I can't find a hint of this anywhere, and of course, Google returns beer.

Am I imagining this?

Upvotes: 1

Views: 1790

Answers (1)

Haren S
Haren S

Reputation: 931

The easiest solution is to probably use $(brew --prefix).

As for the shell variable you're referring to, it's HOMEBREW_PREFIX. I'd be a bit more cautious of this since it requires brew shellenv to have been evaluated.

Consider adding evaluation of this command’s output to your dotfiles (e.g. ~/.profile, ~/.bash_profile, or ~/.zprofile) with: eval "$(brew shellenv)"

Upvotes: 2

Related Questions