Can’t run “pod install” in jenkins


Question or issue on macOS:

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 error from console output of Jenkins job, please check below:

pod: command not found

I tried to run this command “pod install” in local’s terminal of this slave machine and gets succeeds.

could you kindly help on me how to fix this problem?


How to solve this problem?

Solution no. 1:

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.

Solution no. 2:

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

Solution no. 3:

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:

enter image description here

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.

Hope this helps!