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

14
  • 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. Jul 26, 2014 at 0: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, 2014 at 0:44
  • 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, 2014 at 0:46
  • 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, 2016 at 1:46
  • 4
    brew install gcc --without-multilib built in 49 minutes 50 seconds on Mac for me.
    – Cokes
    Mar 22, 2017 at 20:11

4 Answers 4

201

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.

6
  • 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, 2019 at 7:57
  • 3
    after installing xcode command line tools it just took less than 2 min on macbook air Feb 19, 2019 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 Feb 21, 2019 at 20:08
  • 1
    This helped me: stackoverflow.com/questions/30998890/…
    – MethodMan
    Nov 3, 2019 at 18:49
  • On Catalina the command xcode-select --install failed, so I had to download the cli tools from the website instead: developer.apple.com/download/more Nov 11, 2020 at 22:48
11

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

brew install gcc --force-bottle
2
  • macOS 10.13 Error: --force-bottle passed but gcc has no bottle! Sep 8, 2021 at 3:22
  • @SmartNetworks the gcc formula only has bottled binaries down to macOS 10.14 (Mojave) - See formulae.brew.sh/formula/gcc under the "Bottle" table Sep 10, 2021 at 0:19
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
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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.