Friday, March 2, 2012

Move the /Developer folder to an external usb/firewire harddrive or another partition

The installer for Xcode 4 does not allow you to switch the install locations if you just run the installer downloaded from the App Store. When it finishes installing, a directory called Developer will have been created the root of the harddrive. I own a Macbook Air with limited flash space. The developer directory is a pig and I don't really use it much on my laptop, but I wanted to install a few unix utilities from MacPorts. Here is how you do it:

Step 1: I used rsync to move the /Developer folder to my external usb harddrive. You might be able to copy it without rsync, but I used rsync + option "-a" for getting the permissions copied.
sudo rsync -az --progress /Developer /Volumes/USBDRIVE/

Step 2: I then created a symbolic link to the new folder on the usb drive.
sudo ln -s /Volumes/USBDRIVE/Developer /Developer

Step 3 (optional for MacPorts): Edit your macports.conf to include the new location of xcode. I used TextWrangler because it can handle the root access to edit the file. You could also use nano. Look for this line "developer_dir Developer/Applications/Xcode.app/Contents/Developer" and change the path to your path.
sudo open -a TextWrangler /opt/local/etc/macports/macports.conf
OR
sudo nano /opt/local/etc/macports/macports.conf

ALL DONE!!!