3

On OS X 10.11.6, I installed gcc 6.2.0 using homebrew. It lives over in usr/local/Cellar/gcc/6.2.0/bin. After getting it to link (it didn't do this automagically), I cd there and try the solution from this other thread to create an alias

ln -s gcc-6 gcc then gcc --version gives me cc (GCC) 4.9.2 20141029 (prerelease) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

All this is because trying to install things crashes because of -rdynamic flags, that I hope is fixed in a newer version.

6
  • check which gcc, there must be another gcc in your path before this one. Commented Sep 15, 2016 at 19:13
  • which gcc /usr/local/bin/gcc Commented Sep 15, 2016 at 19:33
  • bingo. You have to set your path before that one in your .profile or whatever. Commented Sep 15, 2016 at 19:44
  • Adding usr/local/Cellar/gcc/6.2.0/bin to my .bash_profile did it, thanks. Commented Sep 15, 2016 at 19:48
  • @top1214 hi, how do you install gcc6.2 with brew? I only can get until 6.1 running brew info homebrew/versions/gcc6 Commented Dec 6, 2016 at 13:10

1 Answer 1

2

You created the symlink with the proper target name (gcc) but forgot to set the PATH to your newly installed location (or set it after the system path).

What's confusing is that your system already has a version of gcc installed. You have to override the default path so your gcc command comes first.

  • edit your ~/.profile file and check PATH adjustment. Add a line in the end which contains:

    export PATH=/usr/local/Cellar/gcc/6.2.0/bin:$PATH

Then open a new terminal and ensure that which gcc prints

/usr/local/Cellar/gcc/6.2.0/bin/gcc

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.