Rosetta

Rosetta is a built-in PowerPC emulator present in Intel versions of Mac OS X, which allows PowerPC applications to run unmodified on Intel machines. More information about the technology is available [here].

Preventing Execution

To prevent an application from launching under Rosetta, include the following key in your Info.plist:

<key>LSRequiresNativeExecution</key>
<true/>

When this key is present, the Finder will badge the application icon and display a dialog if the user attempts to launch it .

Detecting Rosetta

The currently-running application

Applications can determine if they are running under an emulator, such as Rosetta, by checking a sysctl selector:

//=============================================================================
//      IsRunningNatively : Is the current app running natively?
//-----------------------------------------------------------------------------
Boolean IsRunningNatively(void)
{   int         isNative;
    size_t      theSize;



    // Check the selector
    //
    // The selector is only provided on systems that can execute processes
    // non-natively, and so if it's not found we must be native.
    isNative = 0;
    theSize  = sizeof(isNative);
    
    if (sysctlbyname("sysctl.proc_native", &isNative, &theSize, NULL, 0) == -1)
        isNative = true;
    
    return((Boolean) isNative);
}

Although this can be used to work around Rosetta-specific bugs, you should always log a bug if you encounter behaviour under Rosetta which does not match a real PowerPC system.

Examining a bundle

Apple supplies sample code for examining the architecture of a bundle before it is executed. This may be useful for an application that uses a plug-in architecture. The sample code is [here].