Skip to content

Mac: https works on a Mac without the Python the app was built with - #45

Merged
juwpegatron merged 1 commit into
mainfrom
fix/mac-https-certificates
Nov 21, 2026
Merged

juwpegatron merged 1 commit into
mainfrom
fix/mac-https-certificates

Conversation

@juwpegatron

Copy link
Copy Markdown
Collaborator

What was wrong

Buddy Lite for Mac could not make any https call on the MacBook Pro 2019 (Intel, macOS 15.7). Every update check in its log failed:

WARNING Update failed: could not reach https://juw12.github.io/buddy/latest.json?t=...: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>

It was the same with 1.10.0 and, after installing it, with 1.13.0. The brain goes through the same kind of call, so a brain on the internet fails the same way.

Cause. The built app carries its own OpenSSL. strings on its libcrypto.3.dylib shows where it looks for certificate authorities: /Library/Frameworks/Python.framework/Versions/3.12/etc/openssl, the folder of the Python the app was built with. That Mac has no Python 3.12, so there is nothing there, and the app ships no certificates of its own.

Why the tests did not see it. The self-test talks to a brain on the same computer, and the updater tests read the manifest from a file. Nothing made an https call from the built app.

The change

  • New mac/buddy_mac/certs.py: when Python's own places hold no certificate authority, use the ones macOS ships: /etc/ssl/cert.pem, and if that is missing or empty, Apple's root keychain through security find-certificate. Certificate and host name checks stay on. The log says once where the authorities came from.
  • core._open (the brain) and both routes of updater._open (update check and download) use that context.
  • The self-test has a new check, https_certificates, and writes the source into report.json.

Checked on the MacBook Pro 2019

  • /usr/local/bin/python3 on that Mac (python.org 3.14, no certificates installed) fails the same way as the app, so Buddy's own updater code was run under it from source:
    • before: could not reach https://juw12.github.io/buddy/latest.json ... CERTIFICATE_VERIFY_FAILED
    • after: https certificates: macos file (128 authorities), manifest read, Mac version 1.13.0. A call to the free brain got an HTTP answer (403 to a bare test request), so the connection itself is made.
  • The installed 1.13.0, started once with SSL_CERT_FILE=/etc/ssl/cert.pem, logged no update failure. Without it the failure came 60 s after every start.
  • pytest mac/tests: 59 passed (8 new in test_certs.py; they need no network and no Mac).

Not checked

  • The app built from this branch, started on that Mac. The build of this pull request can be tried there.
  • A Mac behind a company proxy that swaps certificates: its own certificate is in neither place. SSL_CERT_FILE still works for that, because Python's own places are asked first.

After merging

An installed Buddy on a Mac with this problem cannot fetch the update that fixes it. It needs the install line once: curl -fsSL https://juw12.github.io/buddy/mac-install.sh | bash.

The built app's OpenSSL looks for certificate authorities in
/Library/Frameworks/Python.framework/Versions/3.12/etc/openssl. A Mac that never had
that Python has nothing there, so the update check, the update download and a brain
on the internet all failed with CERTIFICATE_VERIFY_FAILED (seen on the MacBook Pro
2019 with 1.10.0 and 1.13.0). When Python's own places hold no authority, Buddy now
uses the ones macOS ships: /etc/ssl/cert.pem, else Apple's root keychain. Certificate
and host name checks stay on. The self-test has a check for it.
@juwpegatron

Copy link
Copy Markdown
Collaborator Author

Tried the app this pull request builds (Buddy-mac from run 44774932661) on the MacBook Pro 2019, without installing it:

  • The bundle holds no certificate file, as before.
  • Its self-test now reports "https_certificates": "macos file" and the check passes. So on a Mac without the build Python the app finds the 128 authorities in /etc/ssl/cert.pem, where the released 1.13.0 found none.
  • On GitHub's Intel machine the same check passes too (job intel).

One other check, pointer_landed, failed in this run. The screen of the Mac was locked and the installed Buddy was running at the same time; the released 1.13.0 passed all 24 checks on the same Mac an hour earlier with the screen unlocked. Not looked into further.

Still not done: a real update check from this build after a normal start (it logs nothing when it succeeds, and it needs a newer release to exist).

@juwpegatron
juwpegatron merged commit 3ddfdbb into main Nov 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants