LoginSignup
0
0

M1 Mac C++ Environment Setup with GCC

Posted at

First of all

I hate Clang. I'm going to use GCC instead.

How to GCC

Install GCC using homebrew

Terminal
brew install gcc

Check your GCC version

Terminal
brew info gcc

It will print out something like this.

Terminal
==> gcc: stable 13.2.0 (bottled), HEAD
GNU compiler collection
https://gcc.gnu.org/
...

In my case, GCC version is 13.2.0.

Link GCC

Where is your GCC at?

Terminal
which g++-13

That last number number should be changed to your own version.

In most of the cases, it should show up like this.

Terminal
/opt/homebrew/bin/g++-13

Link them

Terminal
sudo ln -s /opt/homebrew/bin/g++-12 /usr/local/bin/g++

If the Terminal says something like this,

Terminal
ln: /usr/local/bin/g++: File exists

Just do this

Terminal
sudo ln -sf /opt/homebrew/bin/g++-13 /usr/local/bin/g++

Finally, check if your GCC is connected from homebrew

Terminal
which g++-13

Terminal
/opt/homebrew/bin/gcc-13

Yay it works!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0