Posted on 09-20-2019 02:20 AM
I realise I am leaving this a little bit late with Catalina just around the corner, but what I really need is to be able to produce a spreadsheet of what 32 Bit Apps are installed on my Mac fleet, with details of which Mac they are on etc.
I am suprised there is not more chat on here about this- hopefully it's because there is an easy solution which I've overlooked!
I have rrouton's script to create a document on each Mac detailing the 32 bit Apps https://derflounder.wordpress.com/?s=32bit but I can't get this to work as an EA as others seem to be doing.
How is everyone else managing this? We do a lot of scientific computing here, and I suspect there are many 32 bit apps in use.
Thanks in advance!
Solved! Go to Solution.
Posted on 09-20-2019 07:50 AM
@amccarty You are the man! That worked perfectly- thanks so much for your help!
Posted on 01-07-2020 08:43 AM
#!/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
# Get logged in user
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
#move the file to the desktop of logged in user
mv "/var/log/32bit_apps_installed.log" /Users/$loggedInUser/Desktop
exit 0 ## Success
exit 1 ## Failure
fi
else log "ERROR! You must be root in order to run this script!" ERROR=1
fi
exit $ERROR
The following script did not work, created a file called Desktop in the users directory and when opened I see the echo'ed: No 32-bit applications found in /Applications, /Library or /usr/local.
@bassic can you post the script again using the correct forum post formatting?
Posted on 01-07-2020 09:26 AM
Hi @JarvisUno is this any better? It works perfectly for me...
#!/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
# get logged in user
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
# move the file to the desktop of logged in user
mv "/var/log/32bit_apps_installed.log" /Users/$loggedInUser/Desktop
exit 0 ## Success
exit 1 ## Failure
fi
else
log "ERROR! You must be root in order to run this script!"
ERROR=1
fi
exit $ERROR
Posted on 01-07-2020 10:30 AM
@bassic Thank you very much I found my syntax error./bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
Is where I went wrong. I forgot to add the back quote to the variable. I only noticed it after I had made the initial post. And after proof reading the code noticed that, that the -l switch was not acting as an option.
When I added the back quote the issue resolved.
`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
Posted on 01-31-2020 03:55 AM
@Hugonaut Just tried your script and deployed it with Jamf - but if fails
#!/bin/sh
Script result: /Library/Application Support/JAMF/tmp/32bit appls listed 31 jan:46:145: execution error: sh: /Users/root/Desktop/32bitapps.txt: No such file or directory (1)
I don´t have any root user and it cannot find this directory. Think the issue is that the script should be run in the logged in user mode?. Jamf run it as sudo so that is where the root account come from
Posted on 01-31-2020 11:16 AM
I ran this script and added it to Self Service. This way if a teacher plans to update they can see if they are running any apps which won't work in Catalina. They are in control of running it and if they have questions about the report they contact tech. This is working out well.
ThirtyTwoBit_app_logfile="/var/log/32bit_apps_installed.log"
ERROR=0
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
loggedInUser=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
mv "/var/log/32bit_apps_installed.log" /Users/$loggedInUser/Desktop
exit 0 ## Success
exit 1 ## Failure
fi
else
log "ERROR! You must be root in order to run this script!"
ERROR=1
fi
exit $ERROR
Posted on 02-02-2020 12:26 PM
So Cannot work as policy but only Self service ?
Posted on 02-03-2020 09:51 AM
No, it is a policy but I place it in Self service, because I don't need every teacher getting reports on their desktop because the questions would be incessant. The self-service policy gives the tech or the teacher the information they require, when they require it.
Posted on 02-05-2020 02:52 AM
@bassic I tried your script and if I run it manual through command line as sudo it works. But when adding it as script, it just everytime write failed - without any kind of info in the log ?
Do you run it through Jamf ?
Posted on 02-05-2020 02:55 AM
Hi @jameson
Yes I run the script via a Self-Service policy. How are you deploying it?
Posted on 02-05-2020 05:57 AM
I've used Go64 (https://www.stclairsoft.com/Go64/index.html) which works well on an individual basis (I've already checked and updated most of our apps first which covers 95% of the app out users have installed).
Posted on 02-06-2020 05:46 AM
I was tired of seing all bunch of nonsense listed in the EA, typical some adobe/microsoft that is rapported as 32bit, but will be no issue after upgrade. So to clean up, i´ve used sed to delete those application I do not want to see ( or users should think off)
#!/bin/bash
cat /var/log/32bit_apps_installed.log | sed -e '/Adobe/d' -e '/LWMacClient/d' -e '/Remote/d' -e '/TeamViewer/d' -e '/Microsoft/d' -e '/Google/d' > /var/log/32bit_apps_installed_edited.log