My slave machine of Jenkins is Mac 10.8. Jenkins run job on my slave machine and run shell command of cocoapods below:
pod install
and got
Ran into the same problem today, but neither of the solutions worked. What did work was changing the install command.
/usr/local/bin/pod install
In my case, my ruby is installed by rvm. I need to load rvm in to find the pod command.
What I did is add this line #!/bin/bash -l
in the beginning of the jenkins job.
It seems the user with which Jenkins is running is not getting the path to the pod
command that you are able to successfully execute from the Node's command shell. All you need to do is explicitly add the path in PATH
variable in your Node's configuration page. To do this, Go to Jenkins > Manage Jenkins > Manage Nodes > Select the Node where your job is running > Click on Configure > Enable Node Properties
. Refer the screenshot below:
Just add the path to your pod command in PATH variable. For ex., if the pod command is present in /usr/bin, then in the name field, enter PATH
and in the value field, enter /usr/bin/:$PATH
I have not worked on Mac but hopefully, the above command should work there too. If it doesn't work, you can put the following line in $HOME/.bash_profile file of the user with which Jenkins is running: PATH=path_to_pod:$PATH
You can find the path to pod command by typing which pod
on command line.