$ g++ --version;
$ brew install gcc;
$ cd /usr/local/bin; ls;
$ g++-13 --version;
$ echo 'alias gcc="/usr/local/bin/gcc-13"' >> ~/.zshrc;
$ echo 'alias g++="/usr/local/bin/g++-13"' >> ~/.zshrc;
$ sudo ln -s /usr/local/bin/gcc-11 /usr/local/bin/gcc;
$ sudo ln -s /usr/local/bin/g++-11 /usr/local/bin/g++;
Reference:
sudo ln -s /usr/local/bin/c++-11 /usr/local/bin/c++;
sudo ln -s /usr/local/bin/cpp-11 /usr/local/bin/cpp;
alias g++="g++ --std=gnu++17"