-
Notifications
You must be signed in to change notification settings - Fork 339
Rosetta2
When managing Apple silicon Macs, it's a common need to ensure that the Rosetta2 Intel translation software is installed in order to run software that has not been re-compiled into native arm64 code.
Consider using this nopkg item:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoremove</key>
<false/>
<key>catalogs</key>
<array>
<string>production</string>
</array>
<key>category</key>
<string>Systems Administration</string>
<key>description</key>
<string>Installs Apple's Rosetta2 Intel instruction translation software for Apple silicon</string>
<key>developer</key>
<string>Apple</string>
<key>display_name</key>
<string>Rosetta translation software</string>
<key>installcheck_script</key>
<string>#!/bin/sh
if [ $(/usr/bin/arch) == "arm64" ] ; then
if ! /usr/bin/arch -x86_64 /usr/bin/true 2>/dev/null ; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi
fi
exit 1
</string>
<key>installer_type</key>
<string>nopkg</string>
<key>minimum_os_version</key>
<string>11.0</string>
<key>name</key>
<string>InstallRosetta2</string>
<key>unattended_install</key>
<true/>
<key>unattended_uninstall</key>
<false/>
<key>uninstallable</key>
<false/>
<key>version</key>
<string>1.0</string>
</dict>
</plist>
The installcheck_script deserves some additional explanation:
#!/bin/sh
if [ $(/usr/bin/arch) == "arm64" ] ; then
if ! /usr/bin/arch -x86_64 /usr/bin/true 2>/dev/null ; then
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
fi
fi
exit 1
The first if statement checks to see if we're running on Apple silicon; if not, we skip to the end.
The second if statement attempts to run the x86_64 (Intel) code for /usr/bin/true
. If Rosetta2 is not installed, that will fail and be evaluated as false; the ! character is a negation or NOT operator, so the statement as a whole would be evaluated as true, leading to an attempt to install Rosetta. If Rosetta is installed, running the x86_64 code for /usr/bin/true
will succeed and the entire statement will be evaluated as false, skipping the attempted install of Rosetta.
Since this nopkg item only installs Rosetta on Apple silicon, and only attempts to install it if it's not already present, this item is safe to put in managed_installs for all machines running macOS 11 or later. It will also re-install Rosetta if it somehow gets removed (there have been some reports or Rosetta disappearing during a macOS update).
The installcheck_script always exits 1 to indicate no need to install since the actual installation (if needed) is taken care of during the installcheck_script. This means that Rosetta2 will be installed before any packages are installed during the "normal" install phase, which is arguably a good thing. If this bothers you, you could replace the installcheck_script with something like
#!/bin/sh
if [ $(/usr/bin/arch) == "arm64" ] ; then
if ! /usr/bin/arch -x86_64 /usr/bin/true 2>/dev/null ; then
# exit 0 to indicate we need to install
exit 0
fi
fi
# exit non-zero to indicate no need to install
exit 1
and then add an postinstall_script like so:
#!/bin/sh
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
This alternate approach is untested by the author.
- Getting Started
- Overview
- Discussion Group
- Demonstration Setup
- Glossary
- Frequently Asked Questions
- Contributing to Munki
- Release Notes
- Introduction
- Managed Software Center in Munki 5.2
- Manual Apple Updates
- force_install_after_date for Apple Updates
- Additional update encouragement
- Aggressive update notifications
- AggressiveUpdateNotificationDays preference
- Additional Munki 5 changes
- Configuration profile notes
- Major macOS upgrade notes
- Upgrading to Munki 5
- Introduction
- Munki Links
- Product Icons
- Screenshots In Product Descriptions
- Client Customization
- Custom Help Content
- Featured Items
- Update Notifications:
- Introduction
- iconimporter
- makepkginfo
- munkiimport
- managedsoftwareupdate
- makecatalogs
- manifestutil
- repoclean
- Preferences
- Default Repo Detection
- Default Manifest Resolution
- Managed Preferences Support In Munki
- Apple Software Updates With Munki
- Pkginfo Files
- Supported Pkginfo Keys
- Pre And Postinstall Scripts
- Munki And AutoRemove
- Blocking Applications
- ChoiceChangesXML
- CopyFromDMG
- nopkg items
- How Munki Decides What Needs To Be Installed
- Default Installs
- Removal of Unused Software
- Upgrading macOS:
- Apple Updates:
- Securing the Munki repo
- Preflight And Postflight Scripts
- Report Broken Client
- MSC Logging
- Munki With Git
- Bootstrapping With Munki
- License Seat Tracking
- LaunchD Jobs and Changing When Munki Runs
- Web Request Middleware
- Repo Plugins
- Downgrading Software
- Downgrading Munki tools
- Authorized Restarts
- Allowing Untrusted Packages
- About Munki's Embedded Python
- Customizing Python for Munki
- Configuration Profile Emulation
- PPPC Privacy permissions
- AutoPkg
- Repackaging
- Creating Disk Images
- Stupid Munki Tricks
- Troubleshooting
- Professional Support
- Known Issues and Workarounds
- Building Munki packages
- Munki packages and restarts
- Signing Munki
- Removing Munki
- More Links And Tools
- Munki Configuration Script
- Who's Using Munki
- Munki 3 Information
- Munki 4 Information
- macOS Monterey Info
- Pkginfo For Apple Software Updates
- Managing Configuration Profiles
- Microsoft Office
- Adobe Products
- Upgrading macOS: