Detecting installed 32-bit applications on macOS Mojave
Over the past couple of OS releases, Apple has made it increasingly clear that 32-bit applications are on the way out. Starting with macOS High Sierra 10.13.4, launching a 32-bit application for the first time will result in a message similar to this being displayed:
macOS High Sierra 10.13.4 and later
macOS Mojave 10.14.x
When the Learn More… button in the alert window is clicked, the following Apple KBase article opens in your default web browser:
32-bit app compatibility with macOS High Sierra 10.13.4 and later
https://support.apple.com/HT208436
To help identify if and where 32-bit applications have been installed, you can use /Applications/Utilities/System Information.app‘s list of installed software to identify which installed applications show up with the following status:
64-Bit (Intel): No
To assist with automating this task, a script is available which uses the /usr/sbin/system_profiler command line tool to detect all 32-bit apps installed in /Applications, /Library or /usr/local and output the list to a logfile stored in /var/log. For more details, please see below the jump.
The script does the following:
1. Checks to see if the script is being run as root.
2. Checks to see if the designated log file is present and creates it if it isn’t.
3. Uses /usr/sbin/system_profiler to pull the complete list of installed applications
4. Filters all applications that are not 64-Bit (Intel) applications.
5. Excludes all non-64-bit applications that are not stored in one of the following locations or their included directories:
/Applications
/Library
/usr/local
6. Outputs the following output to the log:
If any 32-bit applications are found in /Applications, /Library or /usr/local, the path to the delected 32-bit application or applications are listed in the log:
/path/to/32bit_application_name_here.app
If no 32-bit applications are found in /Applications, /Library or /usr/local, the following is output to the log:
No 32-bit applications found in /Applications, /Library or /usr/local.
The script is available below and also on GitHub at the following address:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Detect all 32-bit apps installed in /Applications, /Library | |
# or /usr/local and output list to logfile stored in /var/log. | |
ThirtyTwoBit_app_logfile="/var/log/32bit_apps_installed.log" | |
ERROR=0 | |
# this script must be run with root privileges | |
if [[ "$(/usr/bin/id -u)" -eq 0 ]]; then | |
# Create log file if not present | |
if [[ -f "$ThirtyTwoBit_app_logfile" ]]; then | |
echo "$ThirtyTwoBit_app_logfile found. Proceeding…" | |
else | |
echo "Creating $ThirtyTwoBit_app_logfile log. Proceeding…" | |
touch "$ThirtyTwoBit_app_logfile" | |
fi | |
# Get a list of all installed applications | |
ThirtyTwoBit_app_list=$(/usr/sbin/system_profiler SPApplicationsDataType) | |
if [[ -n "$ThirtyTwoBit_app_list" ]]; then | |
# Get all non-64 Bit applications from the initial list | |
ThirtyTwoBit_app_list=$(echo "$ThirtyTwoBit_app_list" | /usr/bin/grep -A3 "64-Bit (Intel): No") | |
# Filter out all applications in /Applications, /Library and /usr/local | |
ThirtyTwoBit_app_list=$(echo "$ThirtyTwoBit_app_list" | /usr/bin/grep -E "Location:[^/]*/(Applications|Library|usr/local)/") | |
# Remove everything except the path | |
ThirtyTwoBit_app_list=$(echo "$ThirtyTwoBit_app_list" | /usr/bin/sed -n 's/.*Location:[[:space:]]*\(.*\)/\1/p') | |
if [[ -n "$ThirtyTwoBit_app_list" ]]; then | |
echo "$ThirtyTwoBit_app_list" > "$ThirtyTwoBit_app_logfile" | |
echo "List of detected applications available in $ThirtyTwoBit_app_logfile" | |
else | |
echo "No 32-bit applications found in /Applications, /Library or /usr/local." > "$ThirtyTwoBit_app_logfile" | |
fi | |
fi | |
else | |
log "ERROR! You must be root in order to run this script!" | |
ERROR=1 | |
fi | |
exit $ERROR |
Recent Comments