Uninstalling gcc completely in Mac OS X Yosemite?

2019-09-06 12:34发布

问题:

I am trying to uninstall gcc completely from my mac but unable to do so.

Current status :

  ➜  ~  gcc -v
  Using built-in specs. 
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0 /5.0.0/lto-wrapper
  Target: x86_64-apple-darwin14.0.0
  Configured with: ../gcc-5-20141005/configure --enable languages=c++,fortran
  Thread model: posix
  gcc version 5.0.0 20141005 (experimental) (GCC)

~  which gcc
  /usr/local/bin/gcc

I had xcode installed and I removed that completely and also I tried to uninstall using brew. I think I had two different versions installed one using brew and other directly from hpc.sourceforge.net .

回答1:

Since you have your gcc in /usr/local, it is not part of your operating system. The cleanest - but brute force - way is to delete /usr/local completely, and then reinstall the things you want to have there. See also here.

/usr/local is a directory that doesn't come from OSX, but is used by tools like Homebrew. If you delete it, you will lose everything you installed with Homebrew, including Homebrew itself, but you can reinstall it afterwards. You will also lose other tools that install themselves in there. Depending on how much you have there, it may be a quick or a very long procedure.

If you don't want to do this, you have to consult the source that provided you with your gcc. Or you could just rm gcc and its related binaries under /usr/local/bin and everything under /usr/local/libexec/gcc. This will not harm your OS, but it will probably leave you behind with unnecessary files littering your /usr/local. I strongly advice against doing this unless you know what you're doing.