Many a times, we feel the need to install multiple versions of xCode in our MAC. This might be required when you want to develop and test your iPhone/iPad app in multiple iOS versions.
Moreover, with the launch of the latest version of the IDE i.e. the 4.2 version, we feel the need to even test it for the iOS 5.0 version, and at the same time we feel the need to test it for the lower versions too!
Recently I had version 4.1, and feeling the need to test some new features, I thought of installing version 4.2.
So, the approach that worked for me was as follows.
When you have version 4.2, and you downgrade to a previous version say 4.1, and you click the install button, it will ask for an option to install instead of Update as follows:
As you see, automatically, it will create a new folder named Developer-4.2 and install version 4.1 in a folder named Developer.
After the setup is complete, you will have 2 icons- both for versions 4.1 and 4.2 as follows:
You can open any version from the Developer root folder, you will now be having 2 folders, as shown below:
You can also update your Xcode icon to distinguish between the versions. This Link shows you how to change the icon in XCode.
An update: For other version, like 4.0, you might get an option to select a directory when installing, just choose a different directory, instead of your default Developer folder, and you are good to go.