MacOS – How to install g++-45 with Homebrew

gcchomebrewmacos

I have installed gcc45 by using brew tap homebrew/versions & brew install gcc45. However, I can not find g++-4.5 in /usr/local/bin. How can I install g++-4.5 separately by Homebrew? Thanks.

My system 10.6.8.

Best Answer

Looks like the g++ part is not built by default. Build it with brew install gcc45 --enable-cxx and g++-4.5 will appear. See brew info gcc45 for details on the build options.

[@ in /usr/local/bin on ⇄ master]
$ brew install gcc45 --enable-cxx
==> Downloading http://ftpmirror.gnu.org/gcc/gcc-4.5.4/gcc-4.5.4.tar.bz2
Already downloaded: /Library/Caches/Homebrew/gcc45-4.5.4.tar.bz2
==> ../configure --build=x86_64-apple-darwin12.3.0 --prefix=/usr/local/Cellar/gcc45/4.5.4/gcc --datarootdi
==> make bootstrap
==> make install
?  /usr/local/Cellar/gcc45/4.5.4: 909 files, 53M, built in 18.5 minutes
[@ in /usr/local/bin on ⇄ master]
$ ls -l /usr/local/bin/g++-4.5
lrwxr-xr-x  1 janke  admin  33 Apr 25 11:27 /usr/local/bin/g++-4.5 -> ../Cellar/gcc45/4.5.4/bin/g++-4.5