Build Fails for MacOs app on Unreal Engine 5 in a Mac M1 Pro

Hello,

I have a Mac M1 Pro from 2021 and I am trying to package a project for MacOS.

I am using the instructions specified here: Supporting ARM64 and Universal Binaries for Apple Arcade in Unreal Engine | Unreal Engine Documentation

Specifically, where it says:

Engine/Build/BatchFiles/RunUAT.sh BuildCookRun -project=MyProject -platform=Mac -architecture=arm64 -build -cook -stage -deploy

When I perform this on my project, after compilation in the terminal, I get the following error:

Writing manifest to /Users/.../Documents/Unreal Projects/AnkrUnrealSDK/Intermediate/Build/Manifest.xml
Target is up to date
Deploying AnkrUnrealSDKEditor Mac Development...
Deploying now!
Total execution time: 2.96 seconds
Took 3.084248s to run UnrealBuildTool, ExitCode=0
BUILD FAILED: AddBuildProductsFromManifest: /Users/Shared/Epic Games/UE_5.0/Engine/Binaries/Mac/Android/UnrealEditor.modules was in manifest "/Users/.../Documents/Unreal Projects/AnkrUnrealSDK/Intermediate/Build/Manifest.xml" but could not be found.

Essentially a reference to /Users/Shared/Epic Games/UE_5.0/Engine/Binaries/Mac/Android/UnrealEditor.modules is written on the Manifest.xml file, but since that directory / file does not exist it throws. I tried to manually remove the reference in xml file at no avail.

I don’t know what to do anymore!

1 Like

Any luck with this issue?
I’m having getting the same with my project.

Hey just solved this after some research and randomly testing LOL.
Add these lines to your .Target.cs files:

Hey, I did not solve it yet, going to try your fix! Thanks!!

Alright, so the cook advanced with those settings but right in the end I get the following error:

Took 809.509892s to run UnrealEditor-Cmd, ExitCode=1
SafeDeleteFile /Users/timepunk/Library/Logs/Unreal Engine/LocalBuildLogs/Cook-2022.04.22-11.13.25.txt
SafeCopyFile /Users/Shared/Epic Games/UE_5.0/Engine/Programs/AutomationTool/Saved/Cook-2022.04.22-10.59.56.txt /Users/timepunk/Library/Logs/Unreal Engine/LocalBuildLogs/Cook-2022.04.22-11.13.25.txt
SafeDeleteFile /Users/Shared/Epic Games/UE_5.0/Engine/Programs/AutomationTool/Saved/Cook-2022.04.22-10.59.56.txt
==============================================================================
ERROR: Cook failed.
       (see /Users/timepunk/Library/Logs/Unreal Engine/LocalBuildLogs/Log.txt for full exception trace)

CommandletException: Editor terminated with exit code 1 while running Cook for /Users/timepunk/wkspaces/Mothora_vAlpha/Mothora_vAlpha.uproject; see log /Users/timepunk/Library/Logs/Unreal Engine/LocalBuildLogs/Cook-2022.04.22-11.13.25.txt
   at AutomationTool.CommandUtils.RunCommandlet(FileReference ProjectName, String UnrealExe, String Commandlet, String Parameters, String& DestLogFile, Int32 ErrorLevel) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/AutomationUtils/CommandletUtils.cs:line 425
   at AutomationTool.CommandUtils.CookCommandlet(FileReference ProjectName, String UnrealExe, String[] Maps, String[] Dirs, String InternationalizationPreset, String[] CulturesToCook, String TargetPlatform, String Parameters) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/AutomationUtils/CommandletUtils.cs:line 91
   at AutomationScripts.Project.Cook(ProjectParams Params) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/Scripts/CookCommand.Automation.cs:line 268Wrapped by AutomationException: Cook failed.
   at AutomationScripts.Project.Cook(ProjectParams Params) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/Scripts/CookCommand.Automation.cs:line 284
   at BuildCookRun.DoBuildCookRun(ProjectParams Params) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 206
   at BuildCookRun.ExecuteBuild() in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/Scripts/BuildCookRun.Automation.cs:line 41
   at AutomationTool.BuildCommand.Execute() in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/AutomationUtils/BuildCommand.cs:line 344
   at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/AutomationUtils/Automation.cs:line 254
   at AutomationTool.Automation.Process(ParsedCommandLine AutomationToolCommandLine, StartupTraceListener StartupListener, HashSet`1 ScriptModuleAssemblies) in /Users/build/Build/++UE5/Sync/Engine/Source/Programs/AutomationTool/AutomationUtils/Automation.cs:line 153
==============================================================================
AutomationTool executed for 0h 14m 9s
AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)

Ok, I could advance until the end of the cook and I tried to install and run the app and got the following error (where Mothora_vAlpha is the name of my project)

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libtbb.dylib
Referenced from: /Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/Mothora_vAlpha
Reason: tried: '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/../../../libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/../../../../../../../../Shared/Epic Games/UE_5.0/Engine/Binaries/ThirdParty/Intel/TBB/Mac/libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/../UE/Engine/Binaries/ThirdParty/Intel/TBB/Mac/libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/../../../../../../Engine/Binaries/ThirdParty/Intel/TBB/Mac/libtbb.dylib' (no such file), '/Applications/Mac/Mothora_vAlpha.app/Contents/MacOS/../../../../../../../../Shared/Epic Games/UE_5.0/Engine/Binaries/ThirdParty/Steamworks/Steamv147/Mac/libtbb.dylib' (no such
(terminated at launch; ignore backtrace)

Searching a bit leads to this page Third-Party Libraries | Unreal Engine Documentation

Have you got this error after running the built app in your Mac?

Só, this is an issue with the built binary that Unreal generates.
It points to the engine libraries instead of the .app dylib location.
I know the fix for this, just have to find it here.
Give me a moment.

So this is the fix, I hope it helps you.

I think TARGET is the name of your project.
TARGET_SUFFIX would be something like -Mac-Shipping if applicable.
CONTENTS_PATH should be the Exec.app/Contents

This example is fixing for FMOD, but you can run this for every dependency you have.

EXECUTABLE=${CONTENTS_PATH}/MacOS/${TARGET}${TARGET_SUFFIX}
echo “Fixing FMOD dylibs: install_name_tool -add_rpath @executable_path/…/UE4/${TARGET}${TARGET_SUFFIX}/Plugins/FMODStudio/Libs/Mac ${EXECUTABLE}”
install_name_tool -add_rpath @executable_path/…/UE4/“${TARGET}”/Plugins/FMODStudio/Libs/Mac “${EXECUTABLE}”