macOS: encrypted connections fail after Homebrew moved the `openssl` alias to `openssl@4`
维护者通常 1 天内回复
@bewithgaurav 已经在做这个了。
开始于 2026年9月30日。
评估
调研方向
Start with the README installation instructions and the bundled mssql_python_odbc/libs/macos/arm64/lib/libmsodbcsql.18.dylib, then reproduce both Homebrew OpenSSL 3 and OpenSSL 4 cases on Apple silicon. Done means encrypted connections work with the supported OpenSSL setup and the README no longer directs users to a failing installation.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
On macOS with Homebrew, every encrypted connection fails because the bundled ODBC driver cannot load OpenSSL. The cause is Homebrew/homebrew-core#313581, which moved the openssl alias from openssl@3 to openssl@4 on 2026-09-27.
The bundled libmsodbcsql.18.dylib loads OpenSSL only from these two paths:
/opt/homebrew/opt/openssl/lib/
/usr/local/opt/openssl/lib/
In each path, it tries libssl.1.1.dylib and the unversioned libssl.dylib (from strings .../mssql_python_odbc/libs/macos/arm64/lib/libmsodbcsql.18.dylib).
On 2026-09-27, Homebrew moved the openssl alias from openssl@3 to openssl@4 in Homebrew/homebrew-core#313581. The migration is tracked in Homebrew/homebrew-core#278366. Now /opt/homebrew/opt/openssl belongs to openssl@4. When only openssl@3 is installed, brew upgrade removes the link, and the driver finds no OpenSSL.
When openssl@4 is installed, libssl.dylib in that path is OpenSSL 4. The driver loads libssl.4.dylib from the openssl@4 4.0.2_1 bottle, then refuses it with the same error. So the README install step brew install openssl now gives a setup that cannot connect.
Exception message:
mssql_python.exceptions.OperationalError: Driver Error: Client unable to establish connection; DDBC Error: [Microsoft]SSL Provider: [OpenSSL library could not be loaded, make sure OpenSSL 1.0, 1.1, or 3.0 is installed]
Stack trace:
.venv/lib/python3.14/site-packages/mssql_python/db_connection.py:89: in connect
conn = Connection(
.venv/lib/python3.14/site-packages/mssql_python/connection.py:753: in __init__
_raise_connection_error(e)
.venv/lib/python3.14/site-packages/mssql_python/connection.py:125: in _raise_connection_error
raise exc from None
To reproduce
Case A, only OpenSSL 3:
- On Apple silicon, install
openssl@3with Homebrew, and do not installopenssl@4. - Confirm that
/opt/homebrew/opt/openssldoes not exist. - Run the code below.
Case B, OpenSSL 4:
- Run
brew install openssl, as the README says. This installsopenssl@4. - Run the code below.
DYLD_PRINT_LIBRARIES=1showslibssl.4.dylibload before the error.
from mssql_python import connect
connect("Server=tcp:<server>.database.windows.net,1433;Database=<database>;Encrypt=yes;Authentication=ActiveDirectoryDefault")
Workaround: ln -s openssl@3 /opt/homebrew/opt/openssl. After that, the connection succeeds.
Expected behavior
The driver connects with the OpenSSL that Homebrew's openssl installs now, which is OpenSSL 4. If the driver cannot support OpenSSL 4, it finds OpenSSL 3 from openssl@3, for example at /opt/homebrew/opt/openssl@3/lib/, and the README names openssl@3.
Further technical details
Python version: 3.14.7
SQL Server version: Azure SQL Database (serverless)
Operating system: macOS 27.0, arm64
mssql-python: 1.15.0
mssql-python-odbc: 18.6.2.1
Homebrew: 7.0.7, openssl@3 3.6.4_1
Additional context
A later install of openssl@4, for example as a dependency of another formula, takes the openssl link back. Then the driver loads OpenSSL 4 and fails as in case B.
- 主要语言
- Python
- 星标
- 478
- 派生
- 62
- 平均合并
- 3 天 1 小时
- 30 天内合并 PR
- 27
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/mssql-python 的其他 Issue
-
area: bulk-copy
难度 2/5 1-3 小时 新手友好度 70/100
microsoft/mssql-python#843 · 1 条评论 ·
维护者通常 1 天内回复
-
bulkcopy PyCore login is closed by SQL Server 2019 while ODBC and Go clients succeed (1.14.0)可能重新可做 @bewithgaurav 于 34 天前认领,目前没有进行中的 PR。 未关闭area: bulk-copy bug triage done
microsoft/mssql-python#750 · 4 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Announcement: mssql-python is coming to Django through mssql-django 2.0可能重新可做 @bewithgaurav 于 41 天前认领,目前没有进行中的 PR。 未关闭announcement
microsoft/mssql-python#748 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Connection pool can briefly exceed max_size when pooling is disabled under load可能已有人在做 @bewithgaurav 于 23 天前认领。 未关闭area: connectivity-auth bug triage done under development
难度 4/5 3-5 天 新手友好度 62/100
microsoft/mssql-python#746 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Decimal in money range still string-binds on the executemany path可能已有人在做 @bewithgaurav 于 23 天前认领。 未关闭area: data-types bug triage done under development
难度 4/5 3-5 天 新手友好度 48/100
microsoft/mssql-python#745 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 microsoft/mssql-python 的全部 Issue
相似的 Issue
-
Agentic
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
Imbad0202/academic-research-skills#979 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
reflex-dev/reflex#7561 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 62/100
prometheus-community/ansible#906 · 2 条评论 ·