Homebrew without Xcode

Recently I was cleaning up the disk space of my MacBook Air. I realize that Xcode takes up around 10G space and I’m not doing any iOS/macOS development. I know that the only thing I need from Xcode is its command line tools for homebrew. Therefore, I would like to uninstall Xcode while keeping the command line tools.

Remove the Xcode application

First thing to do is to remove the Xcode.app located in ~/Applicationswhich is taking up a huge amount of space. This is pretty easy, just move it to trash and empty your trash.

Update Xcode’s path

After you remove the Xcode.app, your homebrew will have trouble finding all the command binaries. Therefore, we need to update the Xcode path to point it to the actual directory for command line tools. Use the following command (tested on macOS Sierra)

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

After you change the path, homebrew should be able to find all the binaries provided by the command line tools.

Test Homebrew

To make sure everything is working, run brew doctor to check if there is any error. If brew doctor reports nothing and says you are ready to brew, then you are good to go!

 
comments powered by Disqus