Installing Xcode and/or Command Line Tools on Your Mac

Accessing the Terminal app on Mac

Before you can even start the installation process for Node.js or npm, you have to be able to access Terminal. That is where the installation process will take place.

To open up Terminal on Mac, run the following shortcut on your keyboard followed by hitting the return key:

Command key + Space key

And a big input field with the placeholder text "Spotlight Search" will appear in the top left corner of your computer screen.

Screenshot of Spotlight Search

Next, inside that input field, type Terminal.

Screenshot of typing Terminal in Spotlight Search

Then click on the highlighted selection, and a window instance of Terminal will appear. Now you are ready to use it.

One thing to note is that whenever you initially open up Terminal, it opens up in your computer's Home directory, which is represented by the tilde ~ symbol in your Terminal window instance.

Make sure you actually have Xcode installed

  • You can check in two places. First, you can go to the App Store, and type in Xcode in the search bar. If it appears and shows "What's New" along with your current version, then you know that Xcode is installed.
  • Note: It might not actually be your current version as you have to manually place it in your Applications folder! I'll get into that more later.
  • You could also go to the Go tab in the Apple menu, down to Applications, and click on it. It will open the folder. Scroll all the way down, and if you see it in there, you have Xcode installed.

Check if you have Command Line Tools installed

Type the following command in Terminal to check if you have Command Line Tools (CLT) installed:

xcode-select --version

and press the enter/return key. If a version is returned, then you have it installed. If not, then you have to install CLT.

Installing Xcode

Support for Xcode is available on macOS, but you have to install it manually. So if you don't see it listed among your applications in the Applications folder on your Mac, or in the App Store, you don't have it installed.

To find out how to install it, please advance to slide 10, entitled Upgrading Xcode The process is the same.

Installing CLT

Type the following command in Terminal to install CLT:

xcode-select --install

and press the enter/return key.

Checking for CLT

To make sure that installation of CLT was successful, type the following command in Terminal:

xcode-select --version

and press the enter/return key. If a version of CLT is returned, your installation was successful!

Installation Success!

Now that you have CLT installed, you can control your computer from the Command Line (Terminal), use Git commands, npm commands (if Node.js is installed), install Homebrew, and so on. You are ready for some kick-ass developing!

Bonus: how to update Xcode CLT from the Command Line

To update Xcode CLT only, type the following command in Terminal:

softwareupdate --install xcode-select

and press enter/return. To install all updates at once, type the following:

softwareupdate --intall -a

and press enter/return. To get a list of the available software updates on your computer, type:

softwareupdate --list

and press enter/return.

Finding out your version of Xcode

To find out what version of Xcode (NOT CLT) you have installed on your Mac, type the following command in Terminal and then press return:

xcodebuild -version

Upgrading Xcode

No matter what you have been notified, either by the App Store, or somewhere else, you have to update Xcode itself (not the CLT) manually. In order to update Xcode manually, you have to visit the Apple Developers website. Be ready to provide your Apple ID and password, when making your visit. To go to the Apple Developer Site, please visit There, towards the bottom of the article, you will find the link to the Apple Developer site to log in and get the latest release of Xcode, and download it.

It will take a while to download. Once it has completely downloaded, go to Downloads on your computer, and you should see the Xcode icon there as well as the .xip (equivalent to .zip).

Updating Xcode

Updating Xcode at this point is quite easy. Go into your Applications folder, find your old version of Xcode, and dump it in the trash. Then place new version of Xcode in the Applications folder.

To make sure that everything went well, open Terminal, type the following command, and then press return:

xcodebuild -version

If the version you just downloaded and placed in the Applications folder is the one that is printed out to the Terminal Console, then your Xcode update has been successful! You are now good to go!

To make the new Xcode download your default version, run the following command in Terminal:

sudo xcode-select -switch /Applications/

The above Xcode-beta is what appeared for me when I dragged my new Xcode download from the Downloads folder into the Applications folder. Whatever you see in the Applications folder as the Xcode name that appears there is what you should use after the second /.

Finally, run the following command to check what your default Xcode version is now:

xcodebuild -version

For me it was Xcode 13.0, which is exactly what I downloaded.

Related Resources