Posted on 07-26-2021 02:52 AM
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
Solved! Go to Solution.
Posted on 07-26-2021 06:15 AM
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!
Posted on 07-26-2021 11:58 AM
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
Posted on 07-26-2021 05:19 AM
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
Posted on 07-26-2021 06:11 AM
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.
Posted on 07-26-2021 06:15 AM
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!
Posted on 07-26-2021 06:27 AM
Interesting, yes. I could check for a "dummy" x86 pkg failed install.
Thanks for the advice, I'll start testing this theory.
best
Posted on 07-26-2021 06:29 AM
It's the way we do it mate. I try and have as few EAs as possible ideally.
Posted on 07-26-2021 07:20 AM
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>"
Posted on 07-26-2021 11:58 AM
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
Posted on 12-03-2021 07:06 AM
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