Anders Lind
Anders Lind

Reputation: 4840

GCC on Mac OSX--multiple versions of gcc

I think I have several versions of gcc installed on my Mac OSX. Right now, when I type gcc --version. I got gcc (GCC) 4.6.0 20100703 (experimental) . But I want to use earlier version gcc. The thing is, i don't know how to find the path of older version gcc. Can anyone help me? Thanks.

Upvotes: 0

Views: 2796

Answers (1)

Dawood
Dawood

Reputation: 5306

By default, your gcc installations should be in /usr/bin/. So, for example, to use gcc 4.2, you'd use /usr/bin/gcc-4.2 to compile your files. You can do ls /usr/bin/gcc* to see which ones you have installed.

EDIT:
If gcc isn't installed in the default path (i.e., /usr/bin/), then you can execute locate gcc in the terminal to find where it is located.

Upvotes: 2

Related Questions