Sun, 05 Aug 2007

Fix the Annoying Broken Flash Video Player in Firefox

I upgraded Firefox to 2.0.0.6 today, and in the release notes, I found:
Some users have reported problems viewing Macromedia Flash content on Intel Mac computers. To work around this problem, users can remove or move the PowerPC version of "Flash Player Enabler.plugin from /Library/Internet Plug-Ins.
Aha, so that's the problem? Unfortunately, the release notes are a little vague on the details. Never fear, unix-geek is here!

Open Terminal, and type the following commands to produce an Intel-only version of your flash player plugin.

1. Change directory to the proper location (% is the Unix prompt, do not type it in)
% cd '/Library/Internet Plug-Ins/Flash Player.plugin/Contents/MacOS/'

2. Let's take a look what's in this directory.
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
-rwxr-xr-x 1 khan admin 9527552 Feb 20 17:10 Flash Player


3. Verify that it's a Universal binary:
% file 'Flash Player'
Flash Player: Mach-O universal binary with 2 architectures
Flash Player (for architecture ppc): Mach-O bundle ppc
Flash Player (for architecture i386): Mach-O bundle i386


4. Looks good. Let's make a backup copy of Flash Player in case we need it.
% cp 'Flash Player' '.old_Flash Player'

5. Great. Now, let's liposuction the PowerPC fat out of the Universal binary.
% lipo -thin i386 -output 'Flash Player' .old_Flash\ Player

6. Let's see if the file sizes changed:
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
-rwxr-xr-x 1 khan admin 9527552 Feb 20 17:10 .old_Flash Player
-rwxr-xr-x 1 khan admin 5812480 Feb 20 17:10 Flash Player


7. And let's check to see if the new Flash Player is a i386 binary:
% file 'Flash Player'
Flash Player: Mach-O bundle i386

8. Perfect! And just to make sure nothing is using our backup, let's remove all permissions from it (or delete it using 'rm' if you want):
% chmod 000 '.old_Flash Player'

What you're left with is:
% ls -la
total 29976
drwxrwxr-x 4 khan admin 136 Aug 5 13:01 .
drwxrwxr-x 5 khan admin 170 May 9 19:53 ..
---------- 1 khan admin 9527552 Feb 20 17:10 .old_Flash Player
-rwxr-xr-x 1 khan admin 5812480 Feb 20 17:10 Flash Player


This technique can be used to lipo out the PPC executables of all of your Universal binaries if you need the space on your hard disk and you're certain you'll never need to run those binaries on a PPC Mac.

I'll leave this as an exercise to the reader, but you can find all of your Universal binaries using System Profiler (Apple Menu.. About This Mac.. More Info.. Software.. Applications), and use 'cd' to change directory in to /Applications/Application Name.app/Contents/MacOS and 'lipo' the PPC portion of the Universal binary away.

Because Unix treats spaces as argument separators, either single quote all of your files, or precede your space characters with a \ (backslash). You can also use filename completion in your shell by using the TAB key to complete typing in the files.




Khan Klatt

Khan Klatt's photo