title: Can't open lib '/usr/local/lib/libmsodbcsql.13.dylib' : file not found - but file exists
body: <p>I am trying to connect to an MSSQL server from a Jupyter notebook using pyodbc and unixODBC, under macOS 10.15.4.  I have just upgraded OSX to Catalina and my previously working configuration has broken.</p>
  
  <p>I try to connect with:</p>
  
  <pre><code>pyodbc.connect('Driver={ODBC Driver 13 for SQL Server};Server=xxx;Database=xxx;uid=xxx;pwd=xxx;')
  </code></pre>
  
  <p>which throws an error:</p>
  
  <pre><code>Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libmsodbcsql.13.dylib' : file not found (0) (SQLDriverConnect)")
  </code></pre>
  
  <p>But this file exists, and is pointed to by the driver in obdcinst.ini, and links seem correct.</p>
  
  <p>To track this through, I run:</p>
  
  <pre><code>$ odbcinst -j
  
  unixODBC 2.3.4
  DRIVERS............: /etc/odbcinst.ini
  SYSTEM DATA SOURCES: /etc/odbc.ini
  FILE DATA SOURCES..: /etc/ODBCDataSources
  USER DATA SOURCES..: /Users/johnmorgan/.odbc.ini
  SQLULEN Size.......: 8
  SQLLEN Size........: 8
  SQLSETPOSIROW Size.: 8
  </code></pre>
  
  <p>The driver file exists, and is as follows:</p>
  
  <pre><code>$ more /etc/odbcinst.ini
  
  [ODBC Driver 13 for SQL Server]
  Description=Microsoft ODBC Driver 13 for SQL Server
  Driver=/usr/local/lib/libmsodbcsql.13.dylib
  UsageCount=1
  </code></pre>
  
  <p>The indicated Driver is a symlink - this is the 'file not found' file in the error:</p>
  
  <pre><code>$ ls -al /usr/local/lib/libmsodbcsql.13.dylib
  
  lrwxr-xr-x  1 johnmorgan  admin  54 Apr 15 08:13 /usr/local/lib/libmsodbcsql.13.dylib -&gt; ../Cellar/msodbcsql/13.1.9.2/lib/libmsodbcsql.13.dylib
  </code></pre>
  
  <p>and the symlink points to the actual library file:</p>
  
  <pre><code>$ ls -al /usr/local/Cellar/msodbcsql/13.1.9.2/lib/libmsodbcsql.13.dylib
  
  -r--r--r--  1 johnmorgan  admin  2456360 Jan 29  2018 /usr/local/Cellar/msodbcsql/13.1.9.2/lib/libmsodbcsql.13.dylib
  </code></pre>
  
  <p>So as far as I can tell, all the drivers, files and links are all correct.</p>
  
  <p>So why do I get a 'file not found' error, and how can I fix this?</p>
  
  <p>I am aware of others with this problem, eg <a href="https://stackoverflow.com/questions/44527452/cant-open-lib-odbc-driver-13-for-sql-server-sym-linking-issue">Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking issue?</a>, but this has not helped me resolve my issue.</p>