check for OBJC_IMAGE_SUPPORTS_GC (Applications still using the objective-C Garbage Collector) for macOS Sierra compatibility
#!/bin/bash
checkFile(){
FILE=$1
OTOOL=`which otool`
TAIL=`which tail`
IFS='/' read -ra ADDR <<< "$FILE"
unset APP
for i in "${ADDR[@]}"; do
if [[ ! "${i-}" = $'\n' ]]; then
if [[ ! $APP ]] && [[ "$i" == *.app ]]; then
APP="${i}";
fi
fi
done
if [ "$APP" != "$LASTAPP" ]; then
LASTAPP=$APP
PROG=${APP%".app"}
PATH=${FILE%"/Contents/Info.plist"}
if [[ -f ${PATH}/Contents/MacOS/${PROG} ]]; then
CMD=`${OTOOL} -oV "${PATH}/Contents/MacOS/${PROG}" | ${TAIL} -3`
if [[ $CMD == *"OBJC_IMAGE_SUPPORTS_GC"* ]]; then
echo "${PATH}: false";
echo "$CMD";
#else
# echo "${PATH}: true";
fi
fi
fi
}
export -f checkFile
LASTAPP="null"
find / -path "*.app/Contents/Info.plist" -exec bash -c 'checkFile "$0"' {} \;
Written by Philipp Haußleiter
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Macos
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#