Tricky question if we don’t know the full path of the other installs. But basically you could change the $PATH order in your local user .profile
settings. So let’s say your 4.7 install is in /usr/local/bin/
& we know the Apple default version is in /usr/bin/
then edit your .profile
so /usr/local/bin/
comes before /usr/bin/
in $PATH order.
Default should be something like this:
export PATH=/usr/bin:/usr/local/bin:[etc, etc, etc]
Adjusted should be something like this:
export PATH=/usr/local/bin:/usr/bin:[etc, etc, etc]
There is a way to force this change systemwide for all users, but I do not recommend that. Don’t muck around with the deeper—and often non-standard—ways Apple implements a *nix environment. Keep it local to your user.
EDIT: Check the discussion here to see if any solutions offered can help you. It does seem like installing gcc_select
via MacPorts would be the cleanest solution.