I am doing the iOS builds for a group of Unity (Unity3d) game developers.

After pulling the latest git updates, I start up the Unity editor on my Mac and choose "Build Settings", select the iOS target platform, press Build, specify a destination folder and that is it.

Can this exact process be done automatically via the terminal prompt?


1 Answer 1


Android and iOS are not directly supported by the command line utility. However, you can use the command line utility to run a script that will build for iOS. In the simplest form, it would be something like:

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;

public static class AutoBuilder {

    static string GetProjectName()
        string[] s = Application.dataPath.Split('/');
        return s[s.Length - 2];

    static string[] GetScenePaths()
        string[] scenes = new string[EditorBuildSettings.scenes.Length];

        for(int i = 0; i < scenes.Length; i++)
            scenes[i] = EditorBuildSettings.scenes[i].path;

        return scenes;
    static void PerformiOSBuild ()
        BuildPipeline.BuildPlayer(GetScenePaths(), "Builds/iOS",BuildTarget.iPhone,BuildOptions.None);

Then, you would call this from the command line with

-executeMethod AutoBuilder.PerformiOSBuild
  • \$\begingroup\$ How do you change the build target? \$\endgroup\$
    – Ali
    Jan 19, 2018 at 14:35
  • 1
    \$\begingroup\$ @Ali Check out the BuildTarget enum in the BuildPlayer and SwitchActiveBuildTarget methods. \$\endgroup\$
    – House
    Jan 20, 2018 at 16:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .