Case with PATH variable works not all the time. You will still have this issue if you have spaces in your build directory path.
Example: "/Users/youruser/project/my lovely project/WireGuardKitGo"
Also you will have the same error if you have spaces in your build scheme name.