0

I am not sure if I should delete the X Code as it takes a lot of space on MacBook. I want to use g++ compiler for compiling my c++ program.

  • You should probably leave Xcode installed. If you want GCC in particular, I recommend `brew install gcc` (q.v. [brew](https://brew.sh/)), but still keep Xcode installed. – Eljay Feb 19 '20 at 17:10
  • homebrew requires, at a minimum, the Xcode command line tools to be installed. – sweenish Feb 19 '20 at 17:24

1 Answers1

0

It is possible to install just the Xcode command line tools. Open Terminal and execute xcode-select --install. This will get you your compiler (clang, not g++. g++ is just an alias for clang++ on Macs), linker, make, etc.

To actually answer your question, yes. If you install something and then uninstall it, the stuff that got installed will get uninstalled.

If you want the actual g++ compiler, you will need to install it yourself, homebrew is the easiest way. The gcc package will create versioned symlinks for you (g++-9), and you can just use that, or create another symlink that redirects g++ to g++-9. If you did that, you'll have to remember to manually update that symlink when the major version changes. All this is found in usr/local/bin after installing homebrew and the gcc package.

sweenish
  • 4,793
  • 3
  • 12
  • 23