Codesigning/Notarization Problem with UE 4.22.3

We’re trying to deploy an UE Application outside of the Mac Store and everything works great until the actual installation. The Software is codesigned/notarized but the Mac Gatekeeper declines opening it.

The Mac Console throws out errors regarding RPaths even with a complete blank UE project:

/Applications/Appname.app/Contents/MacOS/Appname failed on rPathCmd /Applications/Appname.app/Contents/MacOS/…/…/…//libPhysX3.dylib

Seems to be related to https://developer.apple.com/library/...06/_index.html (“Gatekeeper Changes in macOS 10.10.4 and Later”).

Does anyone have experience how these rpath have to be changed to get application to run properly?

Cheers, Tillman

Already after sacrafising various hours of my life to Apple, I finally managed to get it to work. There are indeed strange absolut rpath buried inside PhysX. Just call the attached python Script to get rid of them. The script accepts the absolut path of the PhysX Folder as the first argument

python rpathChangeScript.py YourApp.app/Contents/Resources/Main/Engine/Binaries/ThirdParty/PhysX3/Mac/

The script than changes all rpaths to @loader_path/ which should work. Worked for me, but no guarantee so do a lot of testing! After the script do the regular codesigning and notarization commands and enjoy your victory over Apple :wink:

#!/usr/bin/env python3
import subprocess
import os
import os.path
import sys


if(len(sys.argv)>1):
	PhysXPath = sys.argv[1]
else:
	PhysXPath = "Appname.app/Contents/UE4/Engine/Binaries/ThirdParty/PhysX3/Mac/"


print 

rightRPath="@loader_path/"
filenames=["libAPEX_Clothing.dylib","libAPEX_Destructible.dylib","libAPEX_Legacy.dylib","libApexFramework.dylib","libNvCloth.dylib","libPhysX3.dylib","libPhysX3Common.dylib","libPhysX3Cooking.dylib","libPxPvdSDK.dylib"]
#"libPxFoundation.dylib" doesn't have a rpath
# (@executable_path/)
for f in filenames:
	if(os.path.exists(PhysXPath+f)):
		print "Processing: " +PhysXPath+f
		command = "otool -l " + PhysXPath+f + " | grep RPATH -A2"
		output = subprocess.check_output(command, shell=True)
		temp = output.split("path ")
		temp2 = temp[1].split(" (offset")
		oldRPath = temp2[0]
		if(oldRPath.find("@")==-1):
			command = "install_name_tool -rpath " + oldRPath + " " + rightRPath+" " + PhysXPath+f
			output = subprocess.check_output(command, shell=True)
			print "Changing rPath for " +PhysXPath+f

There’s also a great step by step from BladeMaster: https://link.medium.com/nQicAYKuqab