OS X Mountain Lion: Need to reinstall Xcode command line tools

So I upgraded to OS X Mountain Lion yesterday. The install was pretty smooth (though had a tough time with the redeem code for the upgrade, worked on the third code that Apple sent across).

Most of the software is working fine. However, I found that my existing Xcode installation needed an upgrade (via a Xcode install from the App Store).

The problem is that any new Xcode install seems to nuke the command line development tools (think make, autoconf, etc.). The solution is pretty simple though. Once Xcode has been installed, run Xcode and then open the preferences. There is a section on downloads, which lists installing the command line tools as an option.

downloads-2012-07-27-11-51.png

Voila! Issue resolved.

Advertisement

13 thoughts on “OS X Mountain Lion: Need to reinstall Xcode command line tools

  1. I did the same thing ONLY when I look at the download section it says my command line tools are already installed. However, they don’t work. E.g. typing > man cat for instance gives man not found.
    How do I force the reinstall of the command line tools?

      1. I’ve checked. man, cat, grep, sudo aren’t on the computer! I just did a reinstall of Mountain Lion from the HL partition and then XCode allowed me to install the command line tools and it still doesn’t recognize these commands and they aren’t on the computer. Spotlight locates gzip and some others but not these main ones.
        I guess I’m going to try erasing the drive, then recover from Time Capsule as of a couple of days ago when everything was working right. I have no idea how they “went away” or why they aren’t reinstalled.

      2. As you suspected, it was a PATH issue. I learned a couple of things here:

        1) Spotlight doesn’t index the /bin and other system areas. For developers sakes, I would like to be able to turn that on for indexing.

        2) When you run port installs, which I had done to install gfortran, it modifies your .bash_profile file in your ~ area. After the install, the profile looks very messy and I noticed an inclusion in the path that I no longer use and while deleting it, I had inadvertently remove the $PATH from the redefinition of the PATH and thus the system information /bin, etc. was lost. I could look up some things like gzip and others I had installed using port and thought erroneously that I could look up cat, sudo, man, etc the same way. Normal unix commands to look things up didn’t work as the commands like find, file, whereis have to be in the path itself to work!

        Thanks for the help.

    1. Aye, the app store is telling me xCode is already installed but it is a really old version like 3.6. Isn’t the newer version more like 4.1?

    2. Mike,

      The current version of XCode (from the App Store) is 4.6.2. In this version (4.x), the download section has been moved and consolidated under the Components section (in preferences).

      XCode-Components Window

      Hope this helps.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.