Running pod install as part of build

I’m trying to setup a build process (on a Mac) that runs “pod install” on the xcode project after the build. I feel like I’m 95% of the way to having it working but am stuck.

As suggested in step 4 of this post, I’ve created a pods.command bash script that does what I want. It changes directory to the created xcode project and runs “pod install”. If I manually run the script after having done the Unity build, it works correctly. Happy days.

Here’s my bash script:

#!/bin/bash
mydir="$(dirname "$BASH_SOURCE")"
cd $mydir/../out/myproject
pod install
open "Unity-iPhone.xcworkspace"

However, I’m now trying to get Unity to run that same script in the post process build stage using this:

var proc = new System.Diagnostics.Process ();
proc.StartInfo.FileName = "Assets/pods.command";
proc.StartInfo.UseShellExecute = false;

In the editor logs, I can see that the script is called successfully, however I’m getting the error:
line 4: pod: command not found

Why would the pod command not be found when running this as a post process, but it’s fine when I run it manually?

I’ve tried setting “proc.StartInfo.UseShellExecute” to both true and false but doesn’t seem to make a difference.

Thanks!

Is your pod added to /usr/bin or /usr/local/bin? If you have only added pod via exporting PATH in .bash_profile, Unity cannot pick it up.

Looks like it’s added to /usr/local/bin, although I notice the owner is “root” rather than my user (most of the other entries in there are owned by my username). Wonder if that could be the problem…?

It wasn’t in my bash_profile as a path, but I tried adding it there for good measure and that still doesn’t work.

I’m having the same problem. Is the issue resolved?