Mac guide
Is it safe to delete Command Line Tools on Mac?
Updated
Command Line Tools is Apple's package of developer tools for the Terminal. It is not a cache, so deleting it doesn't just free space: anything that needs a compiler or git stops working until you install it again. This guide explains what it is, how to check whether you need it, and how to remove and reinstall it.
Short answer: it's safe to delete only if nothing you use needs it. Git, Clang and tools that build software, such as Homebrew, rely on it. It lives in /Library/Developer/CommandLineTools, and you can always reinstall it with xcode-select --install.
This applies to macOS Sonoma 14 and later.
1. What Command Line Tools is
Apple describes the package as the macOS SDK plus command-line tools such as Clang, the compiler. It also brings tools like git and make. It installs into /Library/Developer/CommandLineTools. You usually got it because you ran git for the first time, installed Homebrew, or accepted a prompt to install developer tools.
Xcode includes its own copy of the same tools. If you have Xcode installed, the standalone package may be unused.
2. Check whether you need it
- Open Terminal and run
xcode-select -p. It prints the developer folder macOS uses for these tools. - If it prints
/Library/Developer/CommandLineTools, the standalone package is the one in use. - If it prints a folder inside
Xcode.app, your tools come from Xcode, and the standalone package isn't the active one.
To see how much space it takes, choose Go › Go to Folder in the Finder, enter /Library/Developer, select CommandLineTools and choose File › Get Info.
3. What stops working without it
git,clang,makeand other developer commands. When you run one, macOS offers to install the tools again.- Homebrew, and anything that compiles code when it installs, such as some Python, Ruby and Node packages.
- Apps and scripts that call these tools in the background, such as code editors with git built in.
Your projects, files and Xcode itself are not affected.
4. Remove it
There's no uninstaller: the tools live in that one folder.
- Quit Terminal windows and apps that use git or a compiler.
- In Terminal, run
sudo rm -rf /Library/Developer/CommandLineToolsand enter your administrator password. Type the path carefully: this deletes the folder permanently, without using the Trash. - If you use Xcode, point the tools at it with
sudo xcode-select --switch /Applications/Xcode.app.
5. Reinstall it
Run xcode-select --install in Terminal and follow the dialog. It downloads the current package from Apple. You can also install it from the Downloads page of the Apple Developer site.
With KittoCleaner
KittoCleaner doesn't remove Command Line Tools: it's a tool you install, not a cache. What KittoCleaner clears are the caches around it, which rebuild on their own.
- The Developer Tools tile in Smart Clean covers Xcode DerivedData, simulator caches and the download caches of Homebrew, npm, Yarn, pip, Cargo and others, each badged by risk.
- See command-line tool caches, the Homebrew cache and Xcode DerivedData for what each one is.
Scanning is free; cleaning draws on the free cleaning allowance unless you have Pro or a Single Clean credit. KittoCleaner needs macOS 14 Sonoma or later.
Related
Sources
- Building from the Command Line with Xcode FAQ (Apple Developer, Technical Note TN2339)
- Installing the command-line tools (Apple Developer Documentation)