How to use home-brew g++
You shouldn't need to add the Cellar to your path for this. But Homebrew adds a version suffix to the gcc commands to avoid name clashes with the standard gcc:

pse@Mithos:~$ ssh verence@localhost brew install gcc
[...]
==&gt; Downloading https://homebrew.bintray.com/bottles/gcc-7.3.0.high_sierra.bottle.1.tar.gz
==&gt; Downloading from https://akamai.bintray.com/d0/d09669e3679bb54448f00cda4bf520e631f7487f132ebfe6e0d2f6ecdcd5f6e0?__gda__=exp=1519315844~hmac=df4f6f9b82a2ac5fb5465be3f9dc91c0c3eea0c254e894113edf5fcc2b640c57&amp;response-content-disposition=attachment%3Bfilename%3D%22gcc-7.3.0.high_sierra.bottle.1.tar.gz%22&amp;response-content-type=application%2Fgzip&amp;requestInfo=U2FsdGVkX1-mCWpMqQTGrxnTfILcUZz-NvVoQyGOGSnI4iWY_Z2bJghjhAR-xgGu9cDwVXgE9DLumAnLcf1a5kZAz724Fowtbckow4p_nVq39TQR8WNf4jMP4z7Sql3NQ2dFr1pLXQ3paB2FUCf1_A&amp;response-X-Checksum-Sha1=d492b86b3ba112920165af9df80dd793df1d8f46&amp;response-X-Checksum-Sha2=d09669e3679bb54448f00cda4bf520e631f7487f132ebfe6e0d2f6ecdcd5f6e0
==&gt; Pouring gcc-7.3.0.high_sierra.bottle.1.tar.gz
  /usr/local/Cellar/gcc/7.3.0: 1,486 files, 284.9MB

pse@Mithos:~$ ll /usr/local/bin/g*-7
lrwxr-xr-x  1 verence  admin  29 Feb 22 16:59 /usr/local/bin/g++-7@ -&gt; ../Cellar/gcc/7.3.0/bin/g++-7
lrwxr-xr-x  1 verence  admin  29 Feb 22 16:59 /usr/local/bin/gcc-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcc-7
lrwxr-xr-x  1 verence  admin  32 Feb 22 16:59 /usr/local/bin/gcc-ar-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcc-ar-7
lrwxr-xr-x  1 verence  admin  32 Feb 22 16:59 /usr/local/bin/gcc-nm-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcc-nm-7
lrwxr-xr-x  1 verence  admin  36 Feb 22 16:59 /usr/local/bin/gcc-ranlib-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcc-ranlib-7
lrwxr-xr-x  1 verence  admin  30 Feb 22 16:59 /usr/local/bin/gcov-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcov-7
lrwxr-xr-x  1 verence  admin  35 Feb 22 16:59 /usr/local/bin/gcov-dump-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcov-dump-7
lrwxr-xr-x  1 verence  admin  35 Feb 22 16:59 /usr/local/bin/gcov-tool-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gcov-tool-7
lrwxr-xr-x  1 verence  admin  34 Feb 22 16:59 /usr/local/bin/gfortran-7@ -&gt; ../Cellar/gcc/7.3.0/bin/gfortran-7


So the compiler you are looking for can be invoked with g++-7.