Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I install gcc 4.7 on openbsd using pkg_add. after installation, I use 'gcc -v' to check, I found it is also gcc 4.2 !

how to upgrade gcc 4.2 to gcc 4.7 on openbsd? thank you!

share|improve this question
have you tried with the config file that openbsd must have, so you point to the new gcc installation and not the old one? – poz2k4444 Jan 17 '13 at 4:11
would you please explain 'config file' exactly? Thank you! – siyuan Jan 17 '13 at 14:11
The GCC 4.7 is installed as egcc. Thank you! – siyuan Jan 17 '13 at 16:07

I believe it gets installed as eg++ and egcc in /usr/local/bin/.

share|improve this answer

I get confused at first, but know I could give you a little help since I don't have OpenBSD installed, I thought it was a program not an OS, anyway...

as I see and reading the manual...(Have you read it?)... the correct way to do this would be:

pkg_add -u gcc in order to upgrade... not make a new installation, you could uninstall gcc and try to make a clean installation running pkg_delete gcc, but before you do something, try searching if it's true you have the two versions of gcc running pkg_info it should show you all the packages installed...

Here is the link to the manual for packets and ports and all I can tell you is read the manual... regards..

share|improve this answer

Updating the compiler on a BSD is a big thing. The assumption is you may need to use the compiler to recompile the system on an update. As such, I'm sure you don't update /usr/bin/gcc on a pkgadd. It could leave you with a system that can not be updated.

The compiler is most likely installed in a different directory. Even a simple rename wouldn't help, since gcc is not just gcc, but a whole slew of libraries, headers, and other utilities. You would need to find the directory where the new gcc binary is installed, then prefix that to your PATH.

I would use the pkg_info tool to query where the package was actually installed into. Then I would find the directory where the binaries are, and set PATH=/path/to/new/gcc/bin:$PATH in the appropriate shell startup files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.