168

I'm doing a clean install of Mavericks, and accidentally did

brew install gcc

which is taking over half an hour, maybe more. Should I terminate it? I know now that I should have installed a specific gcc (maybe gcc48) but it's too late and my macbook air is breathing hard.

Currently done downloading all 5 dependencies, but stuck on the "Installing gcc" part. It's downloaded a gcc-4.9.1.tar.bz2, configured and built it, and is stuck on making the bootstrap.

Any advice is appreciated.

This was good advice I saw too late: https://apple.stackexchange.com/questions/38222/how-do-i-install-gcc-via-homebrew

Asked here first: https://superuser.com/questions/788256/brew-install-gcc-mac-os-10-9-mavericks

Community
  • 1
  • 1
ehacinom
  • 8,070
  • 7
  • 43
  • 65
  • 19
    It takes a while to build (I think it took about 45min for me the first time). You can safely cancel if you want. It's entirely up to you. – Alexander O'Mara Jul 26 '14 at 00:43
  • 10
    Homebrew is specifically designed to do everything safely: it builds things in a temporary location, touching nothing outside that location, then installs them into an isolated Cellar, again touching nothing outside of that Cellar, and only then, if everything has worked, does it add links into `/usr/local/*`. – abarnert Jul 26 '14 at 00:44
  • cool :) I will just wait it out, then. However, just exiting the bash shell and then 'brew uninstall gcc' would revert? or would brew be confused because it was only halfway through the build? – ehacinom Jul 26 '14 at 00:44
  • Meanwhile, what does this have to do with Python? And why did you post this on Stack Overflow when it's clearly not a programming problem? Did someone on SuperUser tell you to take it over here? – abarnert Jul 26 '14 at 00:45
  • 1
    Do you actually _want_ `gcc` 4.9 for something? If you want to play with new C++14 features that `clang` doesn't support, or need to compile code that doesn't work with anything but `gcc` 4.6+, or just want to learn more about `gcc`, sure, definitely install it. If not, why waste time and disk space? – abarnert Jul 26 '14 at 00:46
  • 1
    I don't think you need to do `brew uninstall gcc`, because it didn't finish installing. – Alexander O'Mara Jul 26 '14 at 00:48
  • Okay, thanks Alexander! ah, apologies, this has nothing to do with python - you're right, I just thought it did because I was trying to get gfortran for scipy, but that might not be necessary? Brew told me GNU Fortran is installed as part of gcc. I took the question over here so I could have an answer quicker, Superuser is less populated - but I can delete it if it's not a good question. I do have to compile come c++ code but do not think it requires gcc. – ehacinom Jul 26 '14 at 00:50
  • 1
    I think questions on homebrew are allowed here, since it is software developers commonly use. Just make sure it's a specific question with a real answer, rather than opinions. – Alexander O'Mara Jul 26 '14 at 00:53
  • Update - just did: `$ brew install gfortran Error: No available formula for gfortran GNU Fortran is now provided as part of GCC, and can be installed with: brew install gcc` – Dave Everitt Mar 17 '15 at 15:21
  • 5
    Can confirm installation took 38 mins on late-2013 MacbookProR with cpu upgrade. Installation is very CPU heavy (4 cores at 100%). – sjmurphy Feb 11 '16 at 01:46
  • 1
    and 76 mins on a late-2013 MackBookPro without cpu upgrade while watching The Grand Tour. – Squirrel Dec 05 '16 at 22:43
  • 4
    `brew install gcc --without-multilib` built in 49 minutes 50 seconds on Mac for me. – Cokes Mar 22 '17 at 20:11
  • 101 minutes here. – ijoseph Mar 03 '19 at 06:00
  • `/usr/local/Cellar/gcc/10.2.0: 1,463 files, 329.8MB, built in 154 minutes 31 seconds` – Kent Shikama Aug 04 '20 at 06:46

4 Answers4

200

You do need gcc installed to get gfortran, and you do need a fortran compiler for scipy. Homebrew will install a "bottled" (i.e., precompiled) version of the gcc package, which is very fast, if you have the Xcode Command Line Tools installed. These are separate from XCode proper. You can install them with xcode-select --install.

There is no particular need to install a particular version of gcc (and I think those may not be bottled, so they will be equally slow).

In general, interrupting Homebrew with Ctrl+C is safe and Homebrew will automatically recover.

You may be interested in the homebrew-python tap.

Tim Smith
  • 6,127
  • 1
  • 26
  • 32
  • 3
    That isn't true that Brew installs GCC precompiled. I'm trying to install OpenCV which has GCC as a dependency, and I've had the XCode CLT installed for five years now. Brew still opts to build GCC from scratch (and its taken over an hour now). – hpm Feb 10 '19 at 07:57
  • 3
    after installing xcode command line tools it just took less than 2 min on macbook air – aravind_reddy Feb 19 '19 at 14:20
  • 4
    You will likely need to reinstall the Xcode CLT package even if you've installed it before if you have upgraded Xcode since then. I just had Brew take over 20 mins to build GCC even though I use Xcode all the time and have, with previous versions of Xcode, installed the CLT – Jason Campbell Feb 21 '19 at 20:08
  • 1
    This helped me: https://stackoverflow.com/questions/30998890/installing-opencv-with-brew-never-finishes – MethodMan Nov 03 '19 at 18:49
  • On Catalina the command `xcode-select --install` failed, so I had to download the cli tools from the website instead: https://developer.apple.com/download/more/ – aaroncarsonart Nov 11 '20 at 22:48
  • In recent versions, Xcode's command line tools include a `gcc` command which is just a wrapper for clang, not actual gcc, as you can tell from running `gcc --version`. Some people are installing gcc because they need functionality that is in gcc and not in clang, as I am right now. – rakslice Dec 15 '20 at 12:45
11

Try this to force the bottle (pre-compiled) installation

brew install gcc --force-bottle
Christophe Marois
  • 6,471
  • 1
  • 30
  • 32
1

patience a one-word answer... Launch this thing overnight, or budget the time.
Just ran an update on 10.20_4 for a ... 322 minutes wait. That's about 5.5 hours.

Oh, and disk space on your system partition needs > 10GB free.

  /usr/local/Cellar/gcc/10.2.0_4: 1,467 files, 331.8MB, built in 130 minutes 33 seconds
  /usr/local/Cellar/openblas/0.3.15: 23 files, 120.3MB, built in 19 minutes 28 seconds
  /usr/local/Cellar/hdf5/1.12.0_3: 268 files, 16.4MB, built in 5 minutes 5 seconds
  /usr/local/Cellar/netcdf/4.8.0: 95 files, 6.5MB, built in 5 minutes 54 seconds
  /usr/local/Cellar/cython/0.29.23: 440 files, 8.9MB, built in 1 minute 2 seconds
  /usr/local/Cellar/numpy/1.20.2: 1,005 files, 24.3MB, built in 2 minutes 15 seconds
  /usr/local/Cellar/doxygen/1.9.1: 9 files, 15.5MB, built in 1 minute 54 seconds
  /usr/local/Cellar/little-cms2/2.12: 21 files, 1MB, built in 27 seconds
  /usr/local/Cellar/openjpeg/2.4.0: 522 files, 13.1MB, built in 25 seconds
  /usr/local/Cellar/nspr/4.30: 86 files, 1.1MB, built in 24 seconds
  /usr/local/Cellar/nss/3.64: 224 files, 42.4MB, built in 16 minutes 14 seconds
  /usr/local/Cellar/qt@5/5.15.2: 10,384 files, 190.2MB, built in 64 minutes 4 seconds
  /usr/local/Cellar/poppler/21.05.0: 476 files, 26MB, built in 3 minutes 55 seconds
  /usr/local/Cellar/unixodbc/2.3.9_1: 44 files, 1.9MB, built in 1 minute 16 seconds
  /usr/local/Cellar/webp/1.2.0: 39 files, 2.2MB, built in 41 seconds
  /usr/local/Cellar/zstd/1.4.9_1: 31 files, 2.6MB, built in 31 seconds
  /usr/local/Cellar/gdal/3.2.2_4: 329 files, 59.7MB, built in 17 minutes 26 seconds
Jerome
  • 5,583
  • 3
  • 33
  • 76
0

Precompiled fix: 8 minute install time!

I started out unfortunately trying to brew install gcc on my Apple Mojave machine dual core i5. After about an hour of no movement and insane overheating, I terminated the process.

I installed MacPorts. Then installed gcc12 via port. The whole thing including dependencies was done in 8 minutes. See here. https://ports.macports.org/port/gcc12/