How to Install Command Line Tools in Mac OS X (Without Xcode)

Feb 12, 2014 - 39 Comments

Command Line Tools Mac users who prefer to have a more traditional Unix toolkit accessible to them through the Terminal may wish to install the optional Command Line Tools subsection of the Xcode IDE. From MacOS Monterey, Big Sur, Catalina, Mojave, High Sierra, Sierra, OS X El Capitan, Yosemite, Mavericks onward, this is now easily possible directly and without installing the entire Xcode package first, no developer account is required either.

The Command Line Tool package gives Mac terminal users many commonly used tools, utilities, and compilers, including make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp, what, and many other useful commands that are usually found in default linux installations. We’ve included the full list of new binaries available through the command line toolkit below for those interested, or you can just see for yourself after you have installed the package, which we’ll walk through here.


This guide is geared towards MacOS Monterey 12, macOS Big Sur 11, macOS Catalina, macOS Mojave 10.14.x, 10.13 High Sierra, 10.12 Sierra, OS X 10.11 El Capitan, OS X 10.10 Yosemite, and Mac OS X 10.9, and newer releases. Mac users running prior versions of Mac OS X can continue to directly install Command Line Tools and gcc (without Xcode) through a package installer available through the Apple Developer website as described here.

Installing Command Line Tools in Mac OS X

  1. Launch the Terminal, found in /Applications/Utilities/
  2. Type the following command string:
  3. xcode-select --install
    Install command line tools through terminal in Mac OS X

  4. A software update popup window will appear that asks: “The xcode-select command requires the command line developer tools. Would you like to install the tools now?” choose to confirm this by clicking “Install”, then agree to the Terms of Service when requested (feel free to read them thoroughly, we’ll be here)
  5. Confirm installation of command line tools on Mac OS X

  6. Wait for the Command Line Tools package download to complete, it’ll be about 130MB and installs fairly quickly depending on your connection speed
  7. Downloading command line tools

The installer goes away on its own when complete, and you can then confirm everything is working by trying to use one of the commands that were just installed, like gcc, git, svn, rebase, make, ld, otool, nm, whatever you want from the list below. Assuming the installation went uninterrupted, the command will execute as expected. This also means you can compile and install things from source code directly without having to use a package manager. Enjoy your new unix command line toolkit!

What Installs with Command Line Tools and Where

For those interested in knowing the details of what is installed on their Mac and where it’s going, the entire command line toolkit package gets placed in the following directory:

/Library/Developer/CommandLineTools/

You can browse through that directory if you want to, or you can just have awareness of it just in case you want to modify or adjust any of the package at a later time.

Note that directory is the root /Library of Mac OS, not a user ~/Library directory.

If you want to see the 61 new commands available to you, they’re all in /Library/Developer/CommandLineTools/usr/bin/ but we have also listed them alphabetically below for convenience:

ar
as
asa
bison
BuildStrings
c++
c89
c99
cc
clang
clang++
cmpdylib
codesign_allocate
CpMac
cpp
ctags
ctf_insert
DeRez
dsymutil
dwarfdump
dyldinfo
flex
flex++
g++
gatherheaderdoc
gcc
gcov
GetFileInfo
git
git-cvsserver
git-receive-pack
git-shell
git-upload-archive
git-upload-pack
gm4
gnumake
gperf
hdxml2manxml
headerdoc2html
indent
install_name_tool
ld
lex
libtool
lipo
lldb
lorder
m4
make
MergePef
mig
mkdep
MvMac
nasm
ndisasm
nm
nmedit
otool
pagestuff
projectInfo
ranlib
rebase
redo_prebinding
ResMerger
resolveLinks
Rez
RezDet
RezWack
rpcgen
segedit
SetFile
size
SplitForks
strings
strip
svn
svnadmin
svndumpfilter
svnlook
svnrdump
svnserve
svnsync
svnversion
unifdef
unifdefall
UnRezWack
unwinddump
what
xml2man
yacc

Troubleshooting “not currently available” error

Getting an error message that says “Can’t install the software because it is not currently available from the Software Update server”? Well you’re in luck, because that error message probably indicates you already have Xcode installed on the Mac.

From Mac OS X 10.9 onward, if Xcode is already installed in Mac OS X then Command Line Tools becomes installed as well (you can check this by trying to run gcc or make from the terminal). Accordingly, this tutorial is aimed at users who do not want to install the broader Xcode development package, and would rather only have the command line utilities installed instead. Yes, that means you can uninstall the entire Xcode app and only install the command line tools if you want to, since for many users and sysadmins that’s the only reason they installed Xcode to begin with.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

39 Comments

» Comments RSS Feed

  1. Vivek R. Dabholkar says:

    after pip install empyrial
    from empyrial import empyrial, Engine

    does not work!
    —————————————————————————
    ModuleNotFoundError Traceback (most recent call last)
    in
    —-> 1 from empyrial import empyrial, Engine
    2
    3 portfolio = Engine(
    4 start_date = “2020-01-01”,
    5 portfolio = [“SOXL”, “TQQQ”, “DFEN”, “TECL”,”GOOG”],

    ModuleNotFoundError: No module named ’empyrial’

  2. Rob YGK says:

    I had Xcode installed but never used it and it takes up a lot of space. I got rid of it, replacing it with CLT. I got an error message because Brew looks for the gcc compiler in the Xcode.app folder. You need to change the location with the following command:

    sudo xcode-select -s /Library/Developer/CommandLineTools

    • RZKY says:

      So far I don’t have problem with Brew. but NPM is giving me warning like these:

      > node-gyp rebuild
      No receipt for ‘com.apple.pkg.CLTools_Executables’ found at ‘/’.
      No receipt for ‘com.apple.pkg.DeveloperToolsCLILeo’ found at ‘/’.
      No receipt for ‘com.apple.pkg.DeveloperToolsCLI’ found at ‘/’.
      gyp: No Xcode or CLT version detected!

  3. Siddhant Passi says:

    Thx

  4. Cam says:

    It keeps getting
    -bash: xcode-select: command not found
    on step 2
    I’ve downloaded xcode and opened it…

  5. Alex says:

    -bash: x-code-select–install: command not found

    getting this error don’t know whats up

    • paul says:

      You are entering the syntax incorrectly, the correct syntax is:

      xcode-select --install

      You have to enter exact syntax at the command line, if you combine words or commands with a flag or parameter the command will always show an error. The command line offers no leeway or forgiveness, everything must be precise and exact.

      There can be other reasons you see ‘command not found’ error too but in your situation it is simply because the command was entered improperly.

      https://osxdaily.com/2018/05/24/command-not-found-mac-terminal-error-fix/

  6. Mrs. Stephanie McBride says:

    Thanks.

  7. am says:

    Not sure about that one, I’m not very experienced with that. sorry.

    While I can use some of these cmds, there are quite a few I dont know and cant find any documentation about. Anybody know of anyplace that might list and describe some of these?

    • myshlev says:

      You can look at the man (manual) page for a command. At the Terminal command line, enter: man command_name

      For example:

      man gnumake

      or

      man install_name_tool

      This will display the command’s manual page. While viewing the man page, press the “h” key for help.

  8. Brijesh Kumar says:

    When I make a c++ file with extention it says nNothing to be done for filename.cpp .
    How to resolve this problem?

  9. Eng Has says:

    It is very useful. Thank you.

  10. xing_fan says:

    There is no man page for gcc when I excuted that command, and why?

  11. Robert Andrews says:

    How would you uninstall the command line tools (in an environment with no Xcode)?

  12. Lily says:

    But, if I want use wget how do i do .. ?
    That command were not installed, but it’s was in the CommandLineTools package before.
    I juste reboot my mac and I have this error wget : command not found.. Even if I install Xcode correctly.

  13. Luiz says:

    Can I trash current installed xcode and then go through these steps?

  14. Dinesh says:

    Thanks. After execution of xcode-select –install on MAC 10.10.5, valgrind installation is successful.

    Thanks for this page.

  15. Jordan Elpern-Waxman says:

    I am getting the following error after doing the install, while running the ‘port’ command of macports:

    Warning: xcodebuild exists but failed to execute

  16. Renard DellaFave says:

    Fails with a “Can’t download the software because of a network problem.” Maybe now that 10.10 is out they don’t support this for 10.9?
    I just downloaded the older 10.9 command line package from developer. Might not be quite as up to date but 12/2/2014 should be recent enough.

  17. sid says:

    i have installed command line tools like you suggested on my mavericks 10.9.5 .now further how to operate c or c++ like where to write the programs ,how to compile or how to run..i have no idea about all that..

    • David says:

      Save your “myProg.cpp” files in the directory of your choosing.
      Navigate in Terminal to the directory that has your program “myProg.cpp” and run the following to compile:

      g++ -o myProg myProg.cpp

      To run the compiled program from Terminal:

      ./myProg

      You can also open the finder to the Terminal’s current location:

      open .

      Locate your compiled program: “myProg” in finder and just click it to run it.

  18. John R says:

    This was a very useful article. But, I am left wondering about these two questions:

    1. Will this let me do Objective-C and Swift development using emacs and these tools? Or is it restricted to C/C++ only?

    2. If I start with these tools, how do I upgrade to the full Xcode later?

  19. Jonathan García says:

    I have OS X 10.9.2 and Xcode 5.1 and indeed the Command Line Tools already was installed

  20. Virginia Bruce says:

    When I try to restart my computer, since I installed M**icks, I keep getting the message that the process was suspended by “Install command line developer tools.”

    I don’t think I want them, but I’d like for whatever thinks it’s trying to install them to quit.

  21. Chris says:

    On my system they are not located in /Library/Developer/CommandLineTools/

    I don’t know if I did something different during the install or if it’s because I did the install via Xcode (I stumbled upon this article simply because I was trying to find *where* the tools were installed).

    Anyhow, mine ended up in /usr/bin

    Just putting that out there in case something has changed since this was written.

    Thanks for the info though, it helped me finally figure out where the binaries were and what to look for (list helped a lot).

    • aul says:

      Interesting, there should be symlinks between binaries in /Library/Developer/CommandLineTools/ and /usr/bin/ but this is definitely worth noting.

  22. Rick says:

    Another simple way to install these tools is simply to try to run one of them. If it’s not installed, OS X will give you a prompt that asks if you want to install it. If you agree, it does it quickly and easily!

  23. Janusz says:

    Of course manual download and installationn from https://developer.apple.com works fine.

  24. Janusz says:

    xcode-select –install
    xcode-select: error: no developer tools were found, and no install could be requested (perhaps no UI is present), please install manually from ‘developer.apple.com’.

    • ITN says:

      Use two dashes for the xcode-select flag, like –install not -install

      use this:

      xcode-select –install

      not this:

      xcode-select -install

      • nanni says:

        does not work at my end. returns:

        xcode-select: error: invalid argument ‘–install’

        • gkarb says:

          It certainly works but you must enter the proper command. You’re entering the syntax wrong, “xcode-select –install”

          • dave says:

            looks like this web form is mangling the double dash into a single em-dash.

            Copying and pasting the correction given doesn’t work.
            Make sure install has two dashes before it.

      • TJ says:

        Copy and pasting this will NOT work! messes up the two dashes and turns them into a long dash. Type it in yourself, again: with two dashes.

        • leru says:

          Copy / Pasting works fine, just did it, You’re copying and pasting the code wrong. Yes it’s two dashes, don’t type a single dash.

    • Richard says:

      Shame you didn’t get an answer to this. Did you ever work out how to install without a GUI? I’m trying to do it from an SSH session.

  25. TK says:

    Great to know! Time to remove Xcode and HomeBrew, compiling was only reason I installed them :)

    • Joseph says:

      This works to install gcc and command line tools in OS X El Capitan (10.11) and OS X Yosemite (10.10.x)

      In case anyone was wondering, super easy and installs in a minute.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site