# How to uninstall macOS Command Line Tools

This tutorial assumes you have the macOS command-line tools installed on your system. I tested the tutorial on a macOS Catalina installation.

Removing the Command Line Tools from your Mac is pretty simple. Just type the following command on the command line:

```shell
$ rm -fR /Library/Developer/CommandLineTools/
```

***<mark class="bg-yellow-200 dark:bg-yellow-500/30">Warning: </mark>*** <mark class="bg-yellow-200 dark:bg-yellow-500/30">Be careful with this command. </mark> **<mark class="bg-yellow-200 dark:bg-yellow-500/30">rm -fR</mark>** <mark class="bg-yellow-200 dark:bg-yellow-500/30">is a forced and recursive removal of the path you enter. If you make a typo, you may regret removing something else. Because this is a forced removal, there is no way to recover the removed files.</mark>

## How to verify the removal of the macOS Xcode Command Line Tools from your system

If you are not sure this was successful, you can check this by opening your Terminal app and typing the following on your command line:

```shell
$ sudo xcode-select -p
```

**Note**: the ***sudo*** command means executing the ***xcode-select*** command as the admin/root user. This command asks you for your system's admin/root password.

The following error message indicates you do not have the command-line tools installed:

```shell
xcode-select: error: unable to get active developer directory, use `sudo xcode-select --switch path/to/Xcode.app` to set one (or see `man xcode-select`)
```

Removing the command-line tools failed when you get the following response after confirming with the correct admin/root password.

```shell
/Library/Developer/CommandLineTools
```

Another way to check if the command-line tools installation is by directly invoking one of the commands, e.g., **git**, in the following way:

```shell
$ /Library/Developer/CommandLineTools/usr/bin/git --version
```

This command directly invokes the git version packaged with Apple's command-line tools. This command does not require locating **git** in your system's $PATH. The command-line tools were successfully removed from your system when this command returns something like the following:

```plaintext
zsh: no such file or directory: /Library/Developer/CommandLineTools/usr/bin/git
```

When it returns something like the following, you did not successfully remove the command-line tools:

```shell
git version 2.24.3 (Apple Git-128)
```

## How to reinstall the command-line tools

If you regret removing the command-line tools or if you need them again, you can reinstall them with the following commands:

```shell
$ xcode-select --install
```

You get the following pop-up. Click Install, then confirm to accept the terms and conditions. The installation takes a few minutes to complete.

![](https://cdn.hashnode.com/uploads/covers/6a5f4a722e470c360a3c5268/7bb9e39d-791e-4421-a05a-950baad29833.png align="center")

Next, type the following command to reset the default command-line tool path.

```shell
$ sudo xcode-select --reset
```

That should do the trick. You can use the tests above to verify that you installed the command-line tools correctly again.
