How to link gcc? gcc-7.1.0 already installed, it’s just not linked

gcchomebrew

I download the gcc, use brew install gcc
but it said the gcc did not linked.
how to link the gcc? or what should I do?

Best Answer

When you install gcc with :

brew install gcc

it should be automatically linked. But, if for some reasons, it's not. You can link it manually with :

brew link gcc

The command :

brew link --help

gives also some valuable information :

brew ln, link [--overwrite] [--dry-run] [--force] formula:
    Symlink all of formula's installed files into the Homebrew prefix. This
    is done automatically when you install formulae but can be useful for DIY
    installations.

    If --overwrite is passed, Homebrew will delete files which already exist in
    the prefix while linking.

    If --dry-run or -n is passed, Homebrew will list all files which would
    be linked or which would be deleted by brew link --overwrite, but will not
    actually link or delete any files.

    If --force (or -f) is passed, Homebrew will allow keg-only formulae to be linked.