Francis Devereux

October 29, 2008

Installing gcc 3.3 on Mac OS X Leopard/Intel

Filed under: Computers, Mac OS X, Software Development — frankoid @ 5:01 pm

In order to build applications that run on Mac OS versions prior to 10.3.9, you need to use gcc 3.3 (see this Apple documentation for details). This is a problem if you have an Intel Mac running Leopard, because the Xcode 2.5 installer will only allow you to install gcc 3.3 on Tiger. However, there is a way to get it to install anyway… Be warned that Apple probably had a good reason to prevent gcc 3.3 from being installed on Leopard, so this may break your system and/or the binaries that you compile. However, it did work for me and allowed me to compile a small application that ran OK on OS X 10.3.7/PPC. Here’s how to do it:

  1. Install Xcode 2.5, including the 10.3.9 SDK.
  2. Copy gcc3.3.pkg from the Packages/Packages directory in the Xcode Tools disk image to your desktop.
  3. Open the copy of gcc3.3.pkg (right click it and choose “Show Package Contents”).
  4. Open gcc3.3.pkg/Resources/VolumeCheck in a text editor.
  5. Change if( CheckVersion("$SYSTEM_VERS", "10.5", "ProductVersion", ">=" )) to if( CheckVersion("$SYSTEM_VERS", "10.6", "ProductVersion", ">=" )) and save the file.
  6. Double-click on your modified copy of gcc3.3.pkg. You will now be able to install it like any standard Installer package.
  7. “If it breaks you get to keep both pieces.”

Data Recovery with ddrescue and the Freezer Trick

Filed under: Computers, Hardware — frankoid @ 4:42 pm

Recently one of the hard drives in my Linux server failed. I did have a backup but it wasn’t as recent as I’d like and didn’t include some recent emails that I wanted to keep (it’s my main email machine – I did have copies of the emails on my laptop but merging them with the server backup would have been a bit tricky).

At first the filesystems on the failed disk wouldn’t even mount, so I ordered some new drives and resigned my self to restoring from the backup. When the new drives arrived I decided to have one last go at copying my files from the failed drive… and this time the filesystems would mount! Unfortunately the faulty drive wouldn’t talk to my computer for long enough to copy the data off (part way through the copy it would stop responding to the computer and I would have to power-cycle the computer for it to be able to see the disk again).

At this point I had a look on the internet for tools that might help me recover my data and eventually found ddrescue. ddrescue is a clever tool that can copy data from one disk to another, skipping over areas that it can’t read. It logs which areas it couldn’t read, so that it can retry just those areas without having to read the whole disk again. I also read about the “freezer trick” – apparently some failing hard drives will work again briefly after being in a freezer (inside a watertight bag) for a few hours).

So, I ran ddrescue and it managed to read most of my drive. I then froze the drive for about 8 hours and ran ddrescue again. It was able to read some of the previously-unreadable areas, but I’m not sure whether this was because the drive was frozen or not. Anyway, in the end there was only about 10KB of 400GB unreadable, so I was pretty happy.

The next thing I did was improve my backup regime 😉 My server now has 2 drives mirrored using RAID 1, and a 3rd drive that is synchronised with the main drives every night.

Blog at