Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Running pod install as part of build

Discussion in 'iOS and tvOS' started by antifuzz, Jul 30, 2019.

  1. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    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:

    Code (CSharp):
    1. #!/bin/bash
    2. mydir="$(dirname "$BASH_SOURCE")"
    3. cd $mydir/../out/myproject
    4. pod install
    5. 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:

    Code (CSharp):
    1. var proc = new System.Diagnostics.Process ();
    2. proc.StartInfo.FileName = "Assets/pods.command";
    3. 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!
     
  2. Neonlyte

    Neonlyte

    Joined:
    Oct 17, 2013
    Posts:
    512
    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.
     
  3. antifuzz

    antifuzz

    Joined:
    Feb 22, 2013
    Posts:
    99
    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.
     
  4. pppvoid

    pppvoid

    Joined:
    May 24, 2022
    Posts:
    1
    I'm having the same problem. Is the issue resolved?