How to make brew works after uninstalling xcode

On my macbook pro with 128Gb, I’ve uninstall xcode (take almost 12Gb, 10% of the storage!).

Once removed, I’ve notice that homebrew is looking for xcode…


$> brew install dotnet
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics

xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use sudo xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools, or use xcode-select --install to install the standalone command line develo
per tools.
See man xcode-select for more details.

Wait! So when calling


$> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

Cool! I’m stuck…

In fact, I just have to switch to the CommandLine installed


$> sudo xcode-select --switch /Library/Developer/CommandLineTools

And voilà