I would like to use Homebrew to install some stuff,

In the mean time, I have already installed my local gcc, and I want Homebrew to use this specific one (this gcc at /usr/local/bin/gcc is frequently upgraded by myself).

Unfortunately, Homebrew always figure out its gcc dependency, and related libraries, then download them all at /usr/local/Cellar.

For instance:

On my Mac, which gcc indeed points to /usr/local/bin/gcc, when I brew install suite-sparse, it downloads gcc-4.9.1, while I already have gcc-4.9.2 locally.

I just want to keep things simple, use my local gcc with the associated library, e.g. gmp and mpfr (at /usr/local/lib), is it possible with Homebrew?

  • That is not simple :) Homebrew and other packaging systems use an exact build of a tool so that they can test things work - versions of tools give different results and so would not work in the same way - especially compilers.
    – mmmmmm
    Feb 21, 2015 at 17:49
  • Why do you want that gcc and not Homebrew's - or why not use Apple's clang -- answer to this might help us give suggestions to help you
    – mmmmmm
    Feb 21, 2015 at 17:49

1 Answer 1


No, it's not possible. When you install gcc, you must satisfied the required dependencies, otherwise this packages will be installed to ensure that works property.

Required: gmp ✔, libmpc ✘, mpfr ✘, cloog ✘, isl ✘

Same occurs on linux system, you can install gcc without it's dependencies:

Depends: cpp-4.8 (= 4.8.2-19ubuntu1), gcc-4.8-base (= 4.8.2-19ubuntu1), binutils (>= 2.24), libgcc-4.8-dev (= 4.8.2-19ubuntu1), libc6 (>= 2.14), libcloog-isl4 (>= 0.17), libgmp10, libisl10 (>= 0.10), libmpc3, libmpfr4 (>= 3.1.2), zlib1g (>= 1:1.1.4)
Recommends: libc6-dev (>= 2.13-0ubuntu6)
  • Maybe I didn't say it clearly, my gcc is consistent with gmp, mpfr etc... And I woult like to use "this" gcc to compile other package installed by Homebrew, is it possible?
    – lorniper
    Feb 22, 2015 at 10:52
  • Yes, it's posible if you symlink gcc with /usr/local/bin/gcc-4.9. Additionally you can edit the installation script (python) of each formula by brew edit formula.
    – jherran
    Feb 22, 2015 at 13:28
  • I think I already do the symlink, and "which gcc" indeed point to /usr/local/bin/gcc, but Homebrew still download its own dependent gcc, for example, when I "brew install suite-sparse", it downloads gcc-4.9.1, while I alreadyhave gcc-4.9.2 locally
    – lorniper
    Feb 22, 2015 at 13:37
  • Maybe the suite-sparse needs this version of gcc, check it with brew edit suite-sparse.
    – jherran
    Feb 22, 2015 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .