So as a little experiment, and a bit out of necessity, I picked up a new 320G hard drive to replace the nearly full 160G one. I decided to do a restore using only Time Machine since I still have access to the old hard drive in case anything goes wrong.

Out of the box the following does not work:

- Apache (the “Web Sharing” version)
- PHP
- mySQL
- iTunes
- VMWare Virtual Machines (I normally was not backing up the WinXP VM since there’s no data, just a couple applications)
- git

Not a massive list but considering I program, and listen to music while programming, it’s a pretty big chunk of the things I use.

Here’s the steps I followed to get things back up, more for my information than anything else!

1. Edit the host files

I had virtual servers like tel-local.com set up in the /etc/hosts file, which were not backed up. So I just recreated them, ie.

127.0.0.1 tel-local.com

2. Re-create and re-enable /etc/apache2/extra/httpd-vhosts.conf

All the virtual server configurations were gone, so I re-created them. They were just basic entries with nothing special so not a huge loss - otherwise you might want to copy them using a cron job to your Documents folder somewhere.

Then, edited the /etc/apache2/httpd.conf and re-enabled the vhosts line. A quick restart:

3. Repairing disk permissions

I ran Disk Utility, clicked on the hard drive, then ran Repair Disk Permissions. Not sure if it was required but certainly did not hurt anything.

4. Downloaded mysql dmg from mysql.com

Pretty self explanitory, but some additional work needed by following the instructions here:

# Open a terminal window and type in the following commands (without the double quotes):
# type cd /usr/local/mysql
# type sudo chown -R mysql data/, enter your Mac OS X account password when asked for it.
# To start the server, issue sudo echo first, then type sudo ./bin/mysqld_safe &
# Use it with /usr/local/mysql/bin/mysql test

You should be able to drop the /usr/local/mysql bit otherwise follow the instructions on the link above

Don’t forget to set a root password:

mysqladmin -u root password NEWPASSWORD

And also run the startup item package in the installation dmg if you want mysql to run on startup (you probably do)

5. Restore databases

Hopefully you have a mysqldump of your databases, or can get a copy from your production servers. From posts like this one you likely won’t have your databases working off the bat and restoring from a binary dump isn’t such a good idea or even possible.

I did stumble upon a post to restore your mysql database from Time Machine backups, but I did not try to do it.

6. Apache Configuration

This is also a bit outside the scope since everyone’s configuration is different, but some things I had to do was change the DocumentRoot in /etc/apache2/httpd.conf, add index.php to DirectoryIndex and add Options All and AllowOverride All in the directory block (it’s just a local dev server)

In case you run into issues, doing:

sudo apachectl restart

Did not show any errors if the configuration file is wrong. You’ll need to run console (hit the Spotlight and type console) to see the system.log.

7. Install PHP

After the apache configuration is up you’ll nicely display the full source code of your index.php for all to see. Assuming you’d rather the PHP get parsed, follow the instructions here. In short:

- Deactivate the php module in your httpd.conf if you enabled it
- Download and install the appropriate pkg file
- Run said package file

8. iTunes

For some reason the version of iTunes that I had installed before didn’t restore using Time Machine. So I had to manually grab iTunes 8.2 here. A quick google search will probably bring up other locations. You could probably upgrade to the latest version too if you wanted.

9. VMWare

Fortunately the virtual disk was backed up successfully (I had VMWare shut down just before running the Time Machine backup, don’t know if it would copy correctly while it’s still running), but VMWare was giving an error. This article pointed me in the right direction to simply re-install and voila, up and running.

I’ll add additional updates if I find other things that didn’t restore, and hope that this helps someone get their machine up and running - especially if they’re not as lucky as me to still have the old hard drive intact.

UPDATE: If you happen to have an MX 700 printer you can see instructions for re-install on the network here