'XCode script evaluation is different from terminal evaluation

So in one of my project I have a custom "Build Phase" that checks if I have git-lfs installed. Pretty simple, if it's installed, it continues. If not, it stops building.

if which git-lfs >/dev/null; then 
    echo "Git LFS is installed."
else
    echo "warning: Git LFS is not installed"
    exit 1
fi

If I run this code on Mac's Terminal, it says that it's installed. But when I build on XCode, it says it's not installed. I can't find any reason why.

One thing that I have different from the other developers is that I just got a brand new M1 Macbook, so it could be related.

Any ideas?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source