jump to navigation

Check for PowerPC Programs Before Upgrading to Lion July 24, 2011

Posted by Robert Harder in Utility.
Tags: , , ,
trackback

I discovered too late that Mac OS X 10.7 Lion does not support PowerPC executables as Snow Leopard did with Rosetta. I cannot say how long that would have kept me away from Lion, but I definitely would have done some more homework before taking the plunge. If you have not already upgraded, you might want to do a check to see what you might be losing: old printer drivers, scanners, obscure utilities. I have finally lost my scanner, which required a PPC driver in an old copy of Photoshop. Run one of these scripts to generate a list of all PPC-only executables on your system.

What I Lose

Of course applications that are still in development are or will be updated to Intel. It has been a few years now since Apple switched, but there are some things I will lose. My scanner is a set back. Other apps I will miss:

Actually this scan convinced me not to upgrade to Lion on my home computer, so only my laptop has Lion now.

Update: I have installed Snow Leopard in a virtual machine to retain access to my PowerPC applications.

Quick and Dirty

You can get a quick and dirty answer as to which applications are PPC-only by double clicking this script or cutting and pasting it into the Terminal.

Download list-ppc-quick-and-dirty.command.zip

[bash]system_profiler SPApplicationsDataType | awk ‘BEGIN { RS=”” } /PowerPC/ {print PrevLine} {PrevLine=$0}'[/bash]

It does not search your whole drive or command line programs, but if you do not use command line apps much, then this will suffice.

Thorough

The following script performs a more thorough search of your whole hard drive. The script is based on the information from a StackOverflow forum. I just jazzed it up a bit. It will take a while to run, but when it is done, you will have a text file that lists all the PowerPC-only executables on your system.

I have pasted the script below, but you can also download the file and double click it to open it in Terminal, if you are not used to working at the command line. When the script is done, it will open the text file in TextEdit for you.

Download list-ppc.command.zip

Here is the thorough script:

[bash]#!/bin/sh
# Modifier: Robert Harder, http://blog.iharder.net
# Thanks to http://stackoverflow.com/questions/1406456/find-all-ppc-libraries-binaries-and-applications-in-snow-leopard
# Quick and dirty alternative:
# system_profiler SPApplicationsDataType | awk ‘BEGIN { RS=”” } /PowerPC/ {print PrevLine} {PrevLine=$0}’

# Variable and temp file setup
ROOT=/
OUTPUT=~/Desktop/ppc-only.txt
H=$(tput setab 4; tput setaf 3; tput bold)
R=$(tput sgr0)
DIR=$(mktemp -d -t $(basename “$0”))
EXE=${DIR}/executables && touch “$EXE”
EXEf=${DIR}/executables-with-file-run && touch “$EXEf”
P=${DIR}/ppc && touch “$P”
X86=${DIR}/i386 && touch “$X86”
X64=${DIR}/x86_64 && touch “$X64”
Pf=${DIR}/ppc-filtered && touch “$Pf”
Xf=${DIR}/i386-x86_64-filtered && touch “$Xf”
trap “rm -rf ‘${DIR}'” 0 1 2 15

# Initial scan of whole hard drive for executable files
#echo “Searching ${H} ${ROOT} ${R} (this could take a while)”
echo “This could take a while…”
/bin/echo -n “Looking for ${H} all ${R} executables…”
find “$ROOT” -perm -u+x ! -type d 2> /dev/null > $EXE
wc -l “$EXE” | awk ‘{print $1}’
/bin/echo -n “$(tput sgr0)”

# Determine the architecture(s) present in each file
/bin/echo -n “Executing ${H} file ${R} command on executables…$(tput sc)”
C=1
while read LINE; do
/bin/echo -n “$(tput rc)${C}”
file “$LINE” >> “$EXEf”
C=$(( $C + 1 ))
done “$P”
#find “$ROOT” -perm -u+x ! -type d -exec file {} ; 2> /dev/null | grep “ppc$” | awk ‘{print $1}’ > “$P”
wc -l “$P” | awk ‘{print $1}’

# List i386 (32-bit Intel)
/bin/echo -n “Looking for ${H} i386 ${R} executables…”
grep “i386$” “$EXEf” | awk ‘{print $1}’ > “$X86”
#find “$ROOT” -perm -u+x ! -type d -exec file {} ; 2> /dev/null | grep “i386$” | awk ‘{print $1}’ > “$X86”
wc -l “$X86” | awk ‘{print $1}’

# List x86_64 (64-bit Intel)
/bin/echo -n “Looking for ${H} x86_64 ${R} executables…”
grep “x86_64$” “$EXEf” | awk ‘{print $1}’ > “$X64”
#find “$ROOT” -perm -u+x ! -type d -exec file {} ; 2> /dev/null | grep “x86_64$” | awk ‘{print $1}’ > “$X64”
wc -l “$X64” | awk ‘{print $1}’

# Make Intel and PPC lists
cat “$X86” “$X64” | sort | uniq > “$Xf”
cat “$P” | sort | uniq > “$Pf”

# Find entries that are only in the PPC list
echo “pwd: $(pwd)” > “$OUTPUT”
diff “$Pf” “$Xf” | grep -e ‘> “$OUTPUT”
echo “PPC only in ${H} $(pwd)/ppc-only.txt ${R}…$(wc -l $OUTPUT | awk ‘{print $1 – 1}’)”
open -a “TextEdit” “$OUTPUT”[/bash]

Comments»

1. douglas - July 29, 2011

R.I.P. OS X
Time to move to GNU/Linux.

2. Robert Harder - July 29, 2011

@douglas Ha ha. Very funny. =) It’s true that I spend a lot of time at the command line, though!

But the phrase, “Throw the baby out with the bath water comes to mind.”

-Rob

3. Nathan - November 5, 2011

Wish there was a script to move the ppc apps into one folder. I would then transfer this to a PPC chip machine and just keep my legacy ppc apps on that machine and my intel binary apps on my Lion machine.

I like the virtual idea but for me keeping my ppc apps is more of a just in case scenario.

4. James - April 1, 2012

Cool script, but now that I have the list, do I just move the individual files to a folder (or trash)?

I am having constant crashes on my MacBook Pro ever since I installed Lion, so am pleased to find this script (thanks again!), Do you think getting rid of all the PPC code will be a step in the right direction to curing my crash problems?

5. tvd - February 11, 2013

Great script! Any idea why it did not flag Internet Explorer (which used to ship on PPC macs years ago)?

6. ramadan dates - July 27, 2013

I don’t even know how I ended up here, however I thought this submit used to be great. I do not recognise who you are but certainly you’re going to a famous blogger should you aren’t already. Cheers!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: