I am running a customized script which includes a command (ios-sim) which should be known to bash (the binary lies in /usr/local/bin, $PATH knows). However, when invoked by xcodebuild the console logs “command not found”.
I am able to execute the command manually, but I have no idea why it doesn’t work within the run script. I have checked the user but as I expected it is both times the same user…
The line invoking ios-sim:
ios-sim launch $(dirname $TEST_HOST) $environment_args --args -SenTest All $test_bundle_path -v
Rather than relying on
$PATH, the value of which isn’t obvious, use the whole path toios-sim.Edit your custom script and change:
to
The reason why using
$PATHcan be dangerous (perhaps too strong a word) is that it’s not obvious where it’s set. For example Xcode will use the path that’s configured in/etc/launchd.confand/usr/local/binmight have been added in/etc/profileor~/.bash_profile.launchduse the value in/etc/profileand thereby pass it to Xcode to use?/etc/profileor~/.bash_profile?It’s complicated and thorough understanding of this environment will doubtless allow you to invoke your command via
$PATH, however using the fullpath to a command is a simple approach which will always work.