10.4: Find all non-Universal applications

Apr 25, '06 07:30:00AM

Contributed by: Anonymous

Tiger only hintI love my new MacBook Pro with its Intel processor. Unfortunately, not all of the applications that I want to run are Universal. While I am impressed with Rosetta, I eventually want my machine to be 100% Rosetta-free. As I work with this machine, I am finding it hard to keep tabs on which applications lack Intel support. As a result of this frustration, I created a small script to crawl through a directory, such as /Applications, and give me a status report on which programs eventually need to be upgraded/replaced. This not only looks for applications, but also some where just part of the application is PowerPC only.

Copy this code...

#!/bin/sh
# Major limitation, this script assumes that your .app files are in
# /Applications, if someone wants to extend it to work better, please
# do.
# This script will search through a directory that contains .app files 
# and report back which applications are not yet compiled for intel.
# It will also tell you if just "part" of .app is still powerpc only, 
# Garage Band is a good example of this.
# A typical execution of this script would be ./checkbin.sh /Applications/
# This script was developed for personal use, therefore it is far from perfect.
# - chriskearney@gmail.com
if [ "$1x" = "x" ]; then
  echo "usage  : $0 "
  echo "example: $0 /Applications/Utilites"
  exit -1
else
  if [ -d "$1" ]; then
    searchdir=`echo "$1" | sed 's//$//'`
  else
    echo "$0: ERROR: $1 is not a directory"
    exit -1
  fi
fi
find $searchdir -type d -name MacOS -maxdepth 3 2>&1 | 
while read line
do
  app_home=`find "$line" -type f -maxdepth 1 -perm +a=x`
  echo "$app_home" | 
  while read app
  do
    result=`file "$app"`
    echo "$result" | grep "executable" | grep -v "universal" | grep -v "for architecture" >> /tmp/$0.notuniversal.$$
  done  
done
cat "/tmp/$0.notuniversal.$$" | grep "ppc" | awk -F/ '{ print $3 " nt(" $6 ")" }' >> /tmp/$0.output.$$
echo "The following Applications have executables with no intel support: "
echo "-------------------------------------------------------------------" 
cat "/tmp/$0.output.$$" | sed -n 'G; s/n/&&/; /^([ -~]*n).*n1/d; s/n//; h; P'
echo "-------------------------------------------------------------------" 
rm /tmp/*.$$

Save it into a file called checkbin.sh on your Mac, then run the following two commands in Terminal:
$ chmod +x checkbin.sh
$ ./checkbin.sh /Applications/
The script will then tell you which applications need to be upgraded.

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2006041920102987