I tried using this tutorial to download the newest version of g++, and I changed the version number from 4.7 to the newest (which is believe is) 8.1. But I get the following errors
Error: No available formula with the name "gcc81"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
Does anyone know how to update my g++ version? This is what I get when I try to find out my current version.
g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Sorry Im such a noob, I really trying to learn here.
I know this post is a little old but I can shine some light regarding how to accomplish this.
Firstly, to install gcc
/g++
using Homebrew, you should use the following command as mentioned in the comments above: brew install gcc
After doing this, Homebrew should place the installed binaries/symlinks in the correct folders.
To correctly setup the gcc
/g++
command on mac to use the version you just downloaded, I do this by not changing the symlinks gcc
/g++
but instead creating aliases for both gcc
and g++
within my shell environment.
alias gcc='gcc-10'
alias g++='g++-10'
gcc-10
and g++-10
were downloaded using Homebrew. When doing this, Homebrew places gcc-10
and g++-10
in /usr/local/bin (which is on the path) and it allows you to create an alias for the regular gcc
/g++
commands which point to the versions installed by Homebrew.
After doing this, running the command g++ --version
should give you the following:
g++-10 (Homebrew GCC 10.2.0) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You may need to restart your terminal or run source ~/.bashrc
depending on the type of shell you're using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With