53

I am trying to run only native software. So I would like to be able to monitor whether Rosetta 2 is available or not.

I am not asking if Rosetta 2 is running. I am asking if Rosetta 2 is present, is capable of running.

I know I can sort on the Kind column of the process list seen in the Activity Monitor app to find a process currently running through Rosetta 2 or running natively (“Apple”). But I want to know if the Rosetta capability in general has been installed/activated in general on my Mac, even if no app is currently running that way.

1

4 Answers 4

36

The Rosetta 2 installer seems to install at least three files:

$ lsbom -f /Library/Apple/System/Library/Receipts/com.apple.pkg.RosettaUpdateAuto.bom
./Library/Apple/usr/lib/libRosettaAot.dylib 100755  0/0 322368  1011814917
./Library/Apple/usr/libexec/oah/libRosettaRuntime   100755  0/0 352176  1937385839
./Library/Apple/usr/share/rosetta/rosetta   100644  0/0 64  1875722922

So testing for the existance of any of those (or for content in /usr/libexec/rosetta) should show you whether Rosetta actually got installed.

1
  • You can also check for a package receipt: $ pkgutil --pkg-info com.apple.pkg.RosettaUpdateAuto package-id: com.apple.pkg.RosettaUpdateAuto version: 1.0.0.0.1.1693652110 volume: / location: / install-time: 1694126453
    – da4
    Commented Sep 11, 2023 at 20:43
26

Another option is to check if the oahd process is running;

pgrep oahd

Internally rosetta is known as OAH. If it returns a process id you know rosetta is installed. I use the following oneliner in my scripts;

if /usr/bin/pgrep -q oahd; then echo 'rosetta installed'; fi
0
16

This simple one-liner will just print Yes or No:

/usr/bin/pgrep -q oahd && echo Yes || echo No

If you're using Jamf, this code will create an Extension Attribute and populate it accordingly:

#!/bin/sh
#
# reports status of rosetta install

RESULT=$(/usr/bin/pgrep -q oahd && echo Yes || echo No)

echo "<result>$RESULT</result>"
0
4

Looks like the oahd process won't be running until you run the first x86_64 binary after boot.

You can determine whether Rosetta is already installed or not by checking if the x86_64 binary runs without an error.

#!/bin/bash
if [[ `uname -m` != "arm64" ]] ; then
    echo "not arm64"
else
    if ! (arch -arch x86_64 uname -m > /dev/null) ; then
        echo "arm64: no Rosetta installed"
        # softwareupdate --install-rosetta --agree-to-license
    else
        echo "arm64: Rosetta already installed"
    fi
fi

The arch command runs the command using the specified architecture.

% file `which uname`
/usr/bin/uname: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/uname (for architecture x86_64):   Mach-O 64-bit executable x86_64
/usr/bin/uname (for architecture arm64e):   Mach-O 64-bit executable arm64e
% arch -arch x86_64 uname -o -m
Darwin x86_64
% arch -arch arm64 uname -o -m
Darwin arm64
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .