I can't install Xcode - My iMac crashes
Until a few months ago, I had an old version of Xcode (I'm sorry, but I don't remember the version) that I downloaded from the Mac App Store. What I downloaded was like an installer for Xcode, rather than Xcode itself. When Mountain Lion came out, I tried to update to the new version of Xocde (now it was the actual Xcode that downloaded) and it downloaded as usual, but when installing, it made my iMac crash. I tried many times, making my computer crash every time, until it finally installed succesfully (honestly, I don't remember if I did something in order to install it succesfully… I think I deleted the older version, I'm not sure). After that, it worked fine and I thought the problem was solved. I had no problem whatsoever installing it in my new MacBook Air.
Today, Apple released a new update for Xcode. And the same thing as before, when it begins the installation, my iMac freezes for a second and then restarts itself. After the restart, Xcode appears "In Pause" or something like that in Launchpad. If I try to open it, I can downloading it again, but when it finishes downloading and begins the installation, it fails as I've described.
What could be the cause of this? And, of course, what can I do in order to fix it? A permanent fix, preferably.
Thank you.