Article

Published: April 19, 2022

Dexter Codo

Edited: May 26, 2022

Install MacOS command line tools

Learn how to install the essential command line tools package by Apple on macOS Monterey.

Having spent years writing code and developing applications, you might begin automating certain operations with a goal of creating an ideal development environment that works for you. Part of every developer’s environment are the command line tools which include things like Git.

I have spent years perfecting my workstation to my liking, and now I primarily use MacOS as my main driver. Out of the box MacOS is not shipped with developer tools, however, Apple has spent years making it easy for developers to setup a brand new Mac for development purposes.

What are Xcode command line tools?

Command line tools are probably not for you if you’re not comfortable with the Terminal. The Xcode command line tools come in a package that contains a complete set of standard Unix tools. It’s worth mentioning that although the package is named after Xcode (the popular macOS Integrated Development Editor), Xcode is not required to be installed in order to install this package. 

Xcode installation is not required to install Xcode command line tools. Apple developer account is not required as well.

As a Mac user I gain access to essential tools such as make, git, clang and gcc, which are located within the /Library/Developer/CommandLineTools/ folder once they are installed.

I’d recommend installing the package using the following steps which I tested on macOS 12.3 Monterey.

How to install command line tools

To install command line developer tools, all you need to do is run the following command in your terminal:

$ xcode-select --install

The following steps should be familiar where a pop up window will appear asking to confirm the installation or cancel it. Once you hit install, it will prompt you to agree to the terms of service before proceeding. 

The installation may take a few moments depending on your internet speed. Once completed, you have to agree to another Xcode license where you can either do so by running the Xcode application or using the following command: 

$ sudo xcodebuild -license accept

We’re now done setting up. You can verify the installation by attempting to use any of your favourite tools. Mine is Git, so I do the following:

$ git

OUTPUT usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]            [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]            [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]            [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]            [--super-prefix=<path>] [--config-env=<name>=<envvar>]            <command> [<args>]