How to check if Rosetta2 is installed (macOS 11.5)

merlin
New Contributor III

Hi all,

after updating to the latest macOS 11.5 my current way to check if Rosetta2 is installed no longer works.

I used to check for:

/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist

But now that particular plist file doesn't exist anymore.

❯ ls -l /Library/Apple/System/Library/LaunchDaemons/
total 16
-rw-r--r--  1 root  wheel  606  1 Jan  2020 com.apple.MRTd.plist
-rw-r--r--  1 root  wheel  925  1 Jan  2020 com.apple.usbmuxd.plist

 

2 ACCEPTED SOLUTIONS

You can look at the policy logs for that script and it will tell you, but I appreciate that's not Smart Group-able like an EA is.

Of course, one way you'd know is to check the policy logs for an x86-compiled app PKG, as if Rosetta is missing the PKG will fail to install. 

Just thinking of ways for you to check that Apple can't change, like they have with the plist!

View solution in original post

MrRoboto
Contributor III

After macOS 11.5 we can no longer check for the com.apple.oahd.plist. Instead check if the oahd process is running.  

I'm still using the same EA and just updated a single line for the check...

# From this:
if [[ -f "/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist" ]]; then
# To this:
if /usr/bin/pgrep oahd >/dev/null 2>&1; then

View solution in original post

8 REPLIES 8

Ecco_Luke
Contributor II

You can just reinstall it via Terminal, then you know it's done I suppose. We have a script that, amongst other things, queries the processor architecture and install it as the very first thing the Mac does, but that's only helpful on new builds. The command we use is as below:

 

softwareupdate --install-rosetta --agree-to-license

 

merlin
New Contributor III

Thanks, we already use that command to install Rosetta2.
But now I have no way to report/check if the installation went well nor if a machine is missing Rosetta2 altoghether.
We had an Extension Attribute for that, but since last macOS update, it no longer works.

You can look at the policy logs for that script and it will tell you, but I appreciate that's not Smart Group-able like an EA is.

Of course, one way you'd know is to check the policy logs for an x86-compiled app PKG, as if Rosetta is missing the PKG will fail to install. 

Just thinking of ways for you to check that Apple can't change, like they have with the plist!

merlin
New Contributor III

Interesting, yes. I could check for a "dummy" x86 pkg failed install.
Thanks for the advice, I'll start testing this theory.

best

It's the way we do it mate. I try and have as few EAs as possible ideally.

ssmurphy
New Contributor III

I am using the following as an extension Attribute.

Its a mashup of an original EA that was working before the macOS 11.5.0 update and a script from https://github.com/rtrouton/rtrouton_scripts/blob/main/rtrouton_scripts/install_rosetta_on_apple_sil... by the always helpful @rtrouton 

 

#!/bin/bash

: << DOC
EA to determine whether Rosetta is installed.
Possible results:
"installed" - arm64 Mac - Rosetta is installed
"missing" - arm64 Mac - Rosetta is not installed
"ineligible" - Intel Mac - Rosetta cannot be installed
DOC

# is this an ARM Mac?
arch=$(/usr/bin/arch)
if [ "$arch" == "arm64" ]; then
# is rosetta 2 installed?
if /usr/bin/pgrep oahd >/dev/null 2>&1; then
result="installed"
else
result="missing"
fi
else
result="ineligible"
fi

echo "<result>$result</result>"

MrRoboto
Contributor III

After macOS 11.5 we can no longer check for the com.apple.oahd.plist. Instead check if the oahd process is running.  

I'm still using the same EA and just updated a single line for the check...

# From this:
if [[ -f "/Library/Apple/System/Library/LaunchDaemons/com.apple.oahd.plist" ]]; then
# To this:
if /usr/bin/pgrep oahd >/dev/null 2>&1; then

CooperUser
New Contributor II

Here is a script I wrote that checks what the "CPU" is, if Rosetta is installed, and installs it if it is not installed.

#!/bin/bash

#Installs Rosetta 2 if needed.

#Finds what cpu chip the computer has installed.
CPU=$(sysctl -n machdep.cpu.brand_string)
#This variable is the exit status of the executed command ($?). The value 0 = success.
Result=""
#This is a Rosetta file that has a haiku. No idea why it is installed, but cool.
RosettaFile=/Library/Apple/usr/share/rosetta/rosetta
#If CPU is Intel, does NOT install Rosetta.
##If CPU is Apple, DOES install Rosetta.
if [[ "$CPU" =~ ^.*"Intel".*$ ]]
  then echo "Intel processor - No need to install Rosetta."
  Result=$?
elif [[ ! -f "$RosettaFile" && "$CPU" =~ ^.*"Apple".*$ ]]
  then softwareupdate --install-rosetta --agree-to-license
  Result=$?
elif [[ -f "$RosettaFile" && "$CPU" =~ ^.*"Apple".*$ ]]
  then echo "Rosetta already installed."
  cat "$RosettaFile"
  Result=$?
fi

#Did it work?
if [[ "$Result" -ne 0 ]]
  then echo "Rosetta installation failed!"
  Result=1
fi

exit $Result