Skip to content

Instantly share code, notes, and snippets.

@krispayne
Created December 12, 2019 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krispayne/adc512c647e79259b8d1966bf3877b17 to your computer and use it in GitHub Desktop.
Save krispayne/adc512c647e79259b8d1966bf3877b17 to your computer and use it in GitHub Desktop.
EA for 32bit apps
#!/bin/bash
# Detect all 32-bit apps installed in /Applications, /Library
# or /usr/local and output list to logfile stored in /var/log.
runOnce="true"
if [[ "$runOnce" == "true" || "$runOnce" == "1" ]]; then
if [[ -e /usr/local/xattr/.32bitAppsInstalledCheckDone ]]; then
# Using runOnce cached value:
echo "<result>$(cat /usr/local/xattr/.32bitAppsInstalledCheckDone)</result>"
# Delete /usr/local/xattr/.32bitAppsInstalledCheckDone to re-query the computer
exit 0
fi
fi
create32bitCheckDone () {
mkdir -p /usr/local/xattr
echo $1 > /usr/local/xattr/.32bitAppsInstalledCheckDone
}
appList=$(system_profiler SPApplicationsDataType | grep -A3 "64-Bit (Intel): No" | grep -E "Location:[^/]*/(Applications|Library|usr/local)/" | /usr/bin/sed -n 's/.*Location:[[:space:]]*\(.*\)/\1/p')
eaResult=""
# Get a list of all installed applications
# -n = string is not null
if [[ -n "$appList" ]]; then
create32bitCheckDone "$appList"
eaResult="$appList"
else
create32bitCheckDone "Null"
eaResult="No 32-bit apps installed."
fi
echo "$appList"
echo "<result>$eaResult</result>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment