I installed gcc with
brew install gcc, but when I type
gcc the default behavior is still to use
clang. How do I set things so that typing
gcc in the terminal automatically uses the
gcc installed by Homebrew?
You probably will want to examine your $PATH variable. The
gcc from homebrew should reside in
/usr/local/bin and that should be before the Xcode version of
If you change the PATH variable - be sure to log out of the shell or rehash the shell as appropriate.
This answer has an elegant solution using aliases as well - so you don't even have to think or care about path if you have more than one
you can use