Home > Mobile >  Homebrew path variable for Xcode
Homebrew path variable for Xcode

Time:06-07

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?

CodePudding user response:

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)"

  • Related