Last active
August 26, 2021 11:54
-
-
Save talkingmoose/cd142f08c95613e5bff483fa55611b8b to your computer and use it in GitHub Desktop.
In preparation for macOS 10.15, this list identifies 32-bit apps in the Applications folder and returns the list to an extension attribute in Jamf Pro. The returned list may include Xcode because it contains an app with a non-standard file in place of a binary deep within its app bundle. This may be ignored.
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 | |
# create a list of paths in the Applications folder for testing | |
MacOSPaths=$( /usr/bin/mdfind kMDItemKind==Application ) | |
# recurse through the list and create a list of apps with 32-bit binaries | |
while IFS= read aPath | |
do | |
cd "$aPath/Contents/MacOS" | |
testBinary=$( /usr/bin/file * | /usr/bin/grep '64-bit' ) | |
if [ "$testBinary" = "" ]; then | |
foundApp=$( /usr/bin/sed 's/\.app.*$/\.app/g' <<< "$aPath" | /usr/bin/grep ".app" | /usr/bin/awk -F "/" '{ print $NF }' ) | |
# to show full paths, comment line 14 and uncomment line 17 | |
# foundApp="$aPath" | |
foundApps=$( echo -e "$foundApps\n$foundApp" ) | |
fi | |
done <<< "$MacOSPaths" | |
# sort the list and app names to Jamf Pro | |
appList=$( /usr/bin/sed '/^$/d' <<< "$foundApps" | /usr/bin/sort --unique ) | |
echo "<result>$appList</result>" | |
exit 0 |
leaving the the Smart Groups value at nothing worked for me. Thanks for all the help!
Thanks
how can I fetch from extension attribute for all the machine and also I want all the application running from the machine even stored the application in a different place also in different places
any option ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@iRyan757, on line 4, you could replace the command between the parentheses with this:
/usr/bin/find /Applications -name "*.app" -maxdepth 2 -print
This should find apps in the Applications folder and one sub-folder deep like Utilities.