OS X is built upon a UNIX foundation, which grants you access to the benefits that UNIX offers, including the standard toolkit (make, gcc, clang, git, perl, svn, size, strings, id, and a lot more) via the command line developer tools, which are an essential if you're a developer. Aside from developers, the command line tools can offer benefits to normal users as well, like the ability to purge RAM for better performance.
The command line developer tools are automatically installed if you install Xcode. However, Xcode takes up quite a bit of disk space (over 4 GB), and furthermore, it's kind of pointless to install Xcode if you're only going to use the command line developer tools.
Fortunately, there's an easy way to install these developer tools without Xcode, saving you lots of disk space by only installing what you need. The process slightly varies depending on your version of OS X (must be running at least Lion, version 10.7.3) and is outlined below.
If you're on either one of these operating systems, then head over to the Apple Developers website.
You'll need to have a free developer account to login and access the downloads. Just search for Command Line Tools and download the appropriate file.
The download size is pretty small, and from here, the procedure is pretty standard. Just mount the DMG file and run the package installer.
The process shown above actually works for all supported versions of OS X. However, for more recent versions of OS X (version 10.9 +) there's another way of installing the command line developer tools.
You can find and open Terminal via Spotlight Search, from the Utilities folder in Applications, or from your Launchpad.
Once Terminal is up, you will need to type in the following command then press the Enterkey:
- xcode-select --install
You should now see a software update popup asking you the following: "The xcode-select command requires the command line developer tools. Would you like to install the tools now?" Click on the Install button to confirm, then Agree to the License Agreement when requested (have fun reading through this).
Now, you just play the waiting game. Go ahead and take a break; the installer should take over and pretty much handle the rest by itself.
Depending on your connection speed, it shouldn't take too long since the file size isn't too big. Click on Done and you're all set.
If for whatever reason you need to get rid of the command line developer tools, the process is quite simple. Head over to the /Library/Developer/ directory (note that's the root Library) and delete the CommandLineTools folder. You will get a prompt asking for your password; just type it in and you're set.
All the command line developer tools are installed to the /Library/Developer/CommandLineTools/ directory which makes the uninstall process described above quite easy.
If you dive into the /Library/Developer/CommandLineTools/usr/bin/ directory, you can take a look at the huge list of tools that are installed with this package.
The cool thing is that you have to go through this process only once. As updates to the tools become available, you will be able to upgrade to the latest version via the Mac App Store (just like a regular software update).