brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: xcode-select --install gets the Command Line Tools without the full Xcode

Terminal
~/tips/tip-macos-xcode-select-install

xcode-select --install

Installs Apple's compilers and build tools for the terminal without the full Xcode app.

You do not need the whole of Xcode to compile things on a Mac. If all you want is a compiler and the usual build tools for the terminal, Apple has a much smaller package, and one command fetches it.

xcode-select --install

This opens a dialog that downloads and installs the Command Line Tools. Apple describes them as a small, self-contained package with the macOS SDK and command-line tools such as Clang, installed in /Library/Developer/CommandLineTools. Homebrew mentions it in its install requirements too. On Apple silicon you only need the tools to build formulae from source; bottles and casks install without them.

To see which developer folder your tools use right now:

xcode-select -p

With only the Command Line Tools you get /Library/Developer/CommandLineTools. With Xcode installed and selected, it points inside Xcode.app. That matters because the developer tools in /usr/bin are shims that run the real tool from whichever folder is selected.

If you do have Xcode and want the terminal tools to use it, or you keep a beta next to it:

sudo xcode-select --switch /Applications/Xcode.app

The caveat with that one: --switch and --reset need sudo and change the setting for every user on the Mac. For one shell or one script, set the DEVELOPER_DIR environment variable instead, which the man page lists as an override that leaves the system-wide choice alone.

Further reading: Apple TN2339: Building from the Command Line with Xcode FAQ, xcode-select man page (macOS)

Going deeper: Guide: keep your Mac apps in a Brewfile, so a new MacBook is one command away

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link