Skip to content

Instantly share code, notes, and snippets.

@phaus
Last active September 27, 2016 12:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phaus/493d5c54e0dd39b785a5eb1f1dcf9237 to your computer and use it in GitHub Desktop.
Save phaus/493d5c54e0dd39b785a5eb1f1dcf9237 to your computer and use it in GitHub Desktop.
check for OBJC_IMAGE_SUPPORTS_GC 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"' {} \;
@sideshow-systems
Copy link

Awesome! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment