Command line tools on Mac OS X is included with Xcode but you may not want to install the entire Xcode to get git, svn and other packages.
So simply open the terminal and run this command:
A dialog will then open asking if you want to “Get Xcode”, “Not Now” or “Install” so you’ll click the “Install” button.
A download will start and the size is about 130Mb. Once it’s done downloading and installing, you can use any of the packages included in command lines.
This works on OS X Mavericks, Yosemite and I’ve tested it on El Capitan as well, no problems at all.
How to Install Command Line Tools in OS X Mavericks & Yosemite (Without Xcode)