title: Cannot install Python GDAL on Mac OSC High Sierra
body: <p>completely stuck on this one. </p>
  
  <p>trying to run Django (django==1.11.9) in a Python 3.6.3 virtualenv with PostGIS. HighSierra 10.13.6.</p>
  
  <p>Originally I installed gdal2 via homebrew. brew installs GDAL 2.4.0</p>
  
  <p>when I run make:</p>
  
  <pre><code>CPLUS_INCLUDE_PATH=/usr/include/gdal \
          C_INCLUDE_PATH=/usr/include/gdal \
          pip install GDAL==$(gdal-config --version | cut -f-2 -d'.')
  Collecting GDAL==2.2
  Installing collected packages: GDAL
    Found existing installation: GDAL 2.4.0
      Uninstalling GDAL-2.4.0:
        Successfully uninstalled GDAL-2.4.0
  Successfully installed GDAL-2.2.0
  python manage.py migrate
  ...
  File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/importlib/__init__.py", line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 6, in &lt;module&gt;
      from .features import DatabaseFeatures
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/backends/postgis/features.py", line 1, in &lt;module&gt;
      from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/backends/base/features.py", line 4, in &lt;module&gt;
      from django.contrib.gis.db.models import aggregates
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in &lt;module&gt;
      from django.contrib.gis.db.models.aggregates import *  # NOQA
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/models/aggregates.py", line 1, in &lt;module&gt;
      from django.contrib.gis.db.models.fields import ExtentField
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/db/models/fields.py", line 3, in &lt;module&gt;
      from django.contrib.gis import forms, gdal
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/forms/__init__.py", line 3, in &lt;module&gt;
      from .fields import (  # NOQA
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/forms/fields.py", line 4, in &lt;module&gt;
      from django.contrib.gis.geos import GEOSException, GEOSGeometry
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/geos/__init__.py", line 5, in &lt;module&gt;
      from .collections import (  # NOQA
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/geos/collections.py", line 11, in &lt;module&gt;
      from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/geos/geometry.py", line 11, in &lt;module&gt;
      from django.contrib.gis import gdal
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/__init__.py", line 28, in &lt;module&gt;
      from django.contrib.gis.gdal.datasource import DataSource
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/datasource.py", line 39, in &lt;module&gt;
      from django.contrib.gis.gdal.driver import Driver
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/driver.py", line 5, in &lt;module&gt;
      from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in &lt;module&gt;
      from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 49, in &lt;module&gt;
      lgdal = CDLL(lib_path)
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/ctypes/__init__.py", line 348, in __init__
      self._handle = _dlopen(self._name, mode)
  OSError: dlopen(libgdal.so, 6): image not found
  </code></pre>
  
  <p>I've tried a few different uninstalls, installs, and symlinks (and disabling csrutil).</p>
  
  <p>assuming it might be a GDAL version issue, I downgraded from <code>brew install</code> of 2.4 to 2.3.2 via: <a href="http://www.kyngchaos.com/software/frameworks/" rel="nofollow noreferrer">http://www.kyngchaos.com/software/frameworks/</a></p>
  
  <pre><code>$ gdal-config --version
  2.3.2
  
  $ pip3 install gdal==2.3.2
  
      changing mode of build/bdist.macosx-10.13-x86_64/wheel/GDAL-2.3.2.data/scripts/gdal_auth.py to 755
    Traceback (most recent call last):
      File "&lt;string&gt;", line 1, in &lt;module&gt;
      File "/private/var/folders/qw/bp7lqd0914q6xxqq01017h1h0000gn/T/pip-install-rnubsult/gdal/setup.py", line 435, in &lt;module&gt;
        setup(**setup_kwargs)
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 213, in run
        archive_basename = self.get_archive_basename()
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 161, in get_archive_basename
        impl_tag, abi_tag, plat_tag = self.get_tag()
      File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/wheel/bdist_wheel.py", line 155, in get_tag
        assert tag == supported_tags[0]
    AssertionError
  
    ----------------------------------------
    Failed building wheel for gdal
    Running setup.py clean for gdal
  Failed to build gdal
  Installing collected packages: gdal
    Found existing installation: GDAL 2.3.0
      Uninstalling GDAL-2.3.0:
        Successfully uninstalled GDAL-2.3.0
    Running setup.py install for gdal ... done
  Successfully installed gdal-2.3.2
  </code></pre>
  
  <p>but still same err:</p>
  
  <pre><code>...
  File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 49, in &lt;module&gt;
      lgdal = CDLL(lib_path)
    File "/Users/me/.pyenv/versions/3.6.3/lib/python3.6/ctypes/__init__.py", line 348, in __init__
      self._handle = _dlopen(self._name, mode)
  OSError: dlopen(libgdal.so, 6): image not found
  make: *** [update] Error 1
  
   $ sudo find / -name libgdal.so
  </code></pre>
  
  <p>will return multiple "operations not permitted" so it seems like a system permissions or security issue?</p>
  
  <p>any suggestions? </p>
  
  <p>thanks</p>