My app's dylibs not getting recognized as Mach-o after migration. How to troubleshoot / prevent this from happening?

As the title says, I have an application that has a few dylibs right next to it. More often than not, when one of my users migrates from one Mac to another using the Migration Assistant, my app starts crashing since it is not able to recognize the dylibs as a Mach-O file.

Both my app & the libraries are compiled for x86 and run on top of Rosetta. Does this maybe play a part in causing in this issue?

Doing a file <dylib name> returns "data" as the file type.

How to prevent this from happening?

Both my app & the libraries are compiled for x86 and run on top of Rosetta. Does this maybe play a part in causing in this issue?

Is your actual app (meaning, "then executable immediately executes when the user double clicks on it") an x86 app or are you doing something interesting/more complicated than that?

This is a blind guess, but one issue that came up regularly when Rosetta was first introduced is that the "Install Rosetta?" dialog is actually triggered when the "high level" app launches (LaunchServices) encounters an x86 executable. The problem that happened was that apps were using a nonstandard launch process (typically a shell script) which eventually tried to execute "real" x86 executables. However, their initial script was running as ARM*, so it failed completely when it tried to run x86 code.

*FYI, you can "arch" command to force execution to occur in a particular architecture. This will NOT trigger Rosetta installation, but it can be useful in other context:

arch -x86_64 <command>

All it takes to trigger Rosetta installation is having LaunchServices encounter an x86 executable, so bundle "app" that only did this:

int main(int argc, const char * argv[]) {
	return 0;
}

...will trigger Rosetta installation. However, I think better better approach is to convert all or part of the initial launch process into C/ObjC/Swift and then build as x86 instead. Many developer simply rewrote their initial launch script in native code , but this could be as simple as using NSTask to run the same script you were previously running. Either way, this approach side steps all of the complexity of trying to decide what "should" happen and makes sure the system will handle your app exactly the same way it would any other Rosetta app.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

My app's dylibs not getting recognized as Mach-o after migration. How to troubleshoot / prevent this from happening?
 
 
Q