Hi I made an integration to create the builds of one IOS project using fastlane. Everything works as expected except the moment I try to launch a script to run the fastlane command on my Mac Computer using launchctl. When I run the job I get the following error:
/Users/hugoaguero/Documents/acct/branding/usfed/ios/scripts/test.sh: line 2: fastlane: command not found
This happens with the following two lines on my test script (deploy is a lane I created on the fastfile file):
cd ~/Documents/acct/branding/usfed/ios/
fastlane deploy
My pList file resides on the LaunchAgent folder. This is the content of the pList file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.zerowidth.launched.grobankingbuild</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/Users/hugoaguero/Documents/acct/branding/usfed/ios/scripts/test.sh</string>
</array>
<key>StandardErrorPath</key>
<string>/tmp/com.zerowidth.launched.grobankingbuild.err</string>
<key>StandardOutPath</key>
<string>/tmp/com.zerowidth.launched.grobankingbuild.out</string>
<key>StartInterval</key>
<integer>300</integer>
</dict>
</plist>
If I run the command normally from terminal it executes with no issues. The only problem is when it runs from the job.
I'm very new to terminal/Unix, I think that it should be an easy fix but need to solve this as soon as possible. Please help.
Get the full path of the fastlane executable from the command line:
And replace
fastlane
in your script with the full (absolute) path shown by the command here above.