I have a project that runs some utility I've installed using homebrew on one of its build rules.
On my M1 mac, homebrew is installed on /opt/homebrew/bin
.
I have eval "$(/opt/homebrew/bin/brew shellenv)"
present in my ~/.zprofile
file, but it seems like Xcode doesn't respect that (or maybe overrides it?).
When trying to evaluate the PATH
variable during Xcode run script command I get the following:
PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/local/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
For clearance, this is the phase I was running, under Build rules
.
To fix this the solution for now is adding the these lines to my Xcode run scripts.
if [[ ! $PATH =~ /opt/homebrew/bin: ]] ; then
PATH=/opt/homebrew/bin/:/opt/homebrew/sbin:${PATH}
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With