I've found two ways to install the GDAL Python bindings on Mac.
First, you can install the GDAL Framework via QGIS (or get it directly), and then do...
pip download GDAL
tar -xpzf tar -xpzf GDAL-2.3.2.tar.gz
cd GDAL-2.3.2
python setup.py build_ext -I/Library/Frameworks/GDAL.framework/Versions/2.3/Headers -L/Library/Frameworks/GDAL.framework/Versions/2.3/unix/lib --gdal-config /Library/Frameworks/GDAL.framework/Versions/2.3/unix/bin/gdal-config
python setup.py build
python setup.py install
Alternatively, install GDAL via brew, then do similar to the above.
brew install gdal --HEAD
pip download GDAL
tar -xpzf tar -xpzf GDAL-2.3.2.tar.gz
cd GDAL-2.3.2
python setup.py build_ext --gdal-config /usr/local/Cellar/gdal/HEAD-41888_2/bin/gdal-config
python setup.py build
python setup.py install
Do an 'ls /usr/local/Cellar/gdal/' if you need to get the revision number.
import osgeo
osgeo.gdal.VersionInfo()
I have found that sometimes only one version of Python can correctly import gdal without any dramas. For instance, 2.7 and 3.7 both give a "ModuleNotFoundError: No module named 'osgeo'" error, but 3.6 works.
Kelvins-MacBook-Pro-899:~ kelvin$ python3.6
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 26 2018, 19:50:54)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
>>> gdal.VersionInfo()
'2040100'
Hi, am trying install gdal in my macbook, but faced error. Also osgeo has same issue