I'm building a CLI tool as a Swift Package. Part of the process requires me to invoke some processes (such as gsutil). When I try to invoke those, I always end up with
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
Some further analysis revealed that regular commands suchs as pwd or which work just fine. As pictured below, if I try to echo $PATH, I get an incomplete result.
The value of $PATH while running the project directly
/Applications/Xcode-beta.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin\n
is completely different from my actual $PATH variable:
echo $PATH
/Users/skwiggs/google-cloud-sdk/bin:/Users/skwiggs/.npm-global/bin:/Users/skwiggs/.rbenv/bin:/Users/skwiggs/.rbenv/shims:/Users/skwiggs/google-cloud-sdk/bin:/Users/skwiggs/.npm-global/bin:/Users/skwiggs/.rbenv/bin:/Users/skwiggs/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
How can I ensure that my env variables are correctly set while debugging my CLI tool?
