How to resolve USYM_UPLOAD_AUTH_TOKEN environment variable error while exporting with batchmode.

I am using Unity 2019.3.5f1 editor, and trying to export ios project with batchmode command line option, but I am getting error message while building exported XCode project, saying: “Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment variable.”

My command is:

/Applications/Unity/Hub/Editor/2019.3.5f1/ -batchmode -nographics -silent-crashes -projectpath ~/Unity_Project/ -logfile ~/Unity.log -executeMethod CIEditorScript.PerformIOSBuild -quit -username -password MyPassw@rd

CIEditorScript.cs file’s contents are:

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

public class CIEditorScript
	static string[] SCENES = FindEnabledEditorScenes ();

	static string TARGET_DIR = "/Users/username/export-ios";

	[MenuItem ("Custom/CI/Build iOS")]
	static void PerformIOSBuild ()
		BuildOptions iosBuildOptions =  BuildOptions.AcceptExternalModificationsToPlayer;
		GenericBuild (SCENES, TARGET_DIR + "/ios/", BuildTarget.iOS, iosBuildOptions);

	[MenuItem ("Custom/CI/Build Android")]
	static void PerformAndroidBuild ()
		BuildOptions androidBuildOptions =  BuildOptions.AcceptExternalModificationsToPlayer;
		GenericBuild (SCENES, TARGET_DIR + "/android/", BuildTarget.Android, androidBuildOptions);

	private static string[] FindEnabledEditorScenes ()
		List<string> EditorScenes = new List<string> ();
		foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) {
			if (!scene.enabled)
			EditorScenes.Add (scene.path);
		return EditorScenes.ToArray ();

	static void GenericBuild (string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options)
		EditorUserBuildSettings.SwitchActiveBuildTarget (build_target);
		BuildPipeline.BuildPlayer (scenes, target_dir, build_target, build_options);

I need help in resolving this issue.

Hi. You need to have the “GoogleService-Info.plist” file in the XCode project folder (“/Users/username/export-ios/ios/”).