MacOS – How to install Xcode from downloaded package


I recently uninstalled all dev tools from OS X after having issues with gcc and realizing both Xcode 3 and 4 were installed – but not before saving an Xcode package file to the desktop. It's over 3 GB and I assumed that in some way I could use that to re-install it.

How can I use it to re-install Xcode?

The purpose for re-installing is so that I know for certain that the latest version of Xcode is being used for any future attempts at compiling code which I call from the terminal (for a local build of Google's V8).

P.S. Do I even need to re-install at all? I don't understand why double-clicking on this 3 GB Xcode file does seem to load the IDE just fine which seems to indicate it's relying on compilation tools and other components held inside the package, rather than looking for them elsewhere in the system. (Which I imagine should be the case considering the fact that I just *un*installed dev tools from OS X.)

Best Answer

As Adam stated, Xcode 4.3 switched over to being a self-contained application. I would suggest uninstalling the old version of Xcode as he stated, then just copying the new .app over into your Applications folder. Finally, delete the whole /Developer directory.

However, Apple decided to make the mistake of not updating the paths for the development tools. So, you need to update those paths manually. If you've put Xcode in your Applications folder, you can run the following in Terminal to switch the paths over to your new app location:

sudo xcode-select -switch /Applications/

If you need to check the current path, you can do the following:

xcode-select -print-path