Problem

ImportError: dlopen(.../lib/python3.11/site-packages/xmlsec.cpython-311-darwin.so, 0x0002): Symbol not found: _xmlSecSoap11Ns


Solution

brew edit seems to have broken in a recent update, so here's an even hackier workaround that almost fails but still got me what I needed:

Remove the official formula

> brew uninstall libxmlsec1 Uninstalling /opt/homebrew/Cellar/libxmlsec1/1.3.1_1... (220 files, 7.5MB)`

Download the last known good formula and shove it into /tmp

> export DESIRED_SHA="7f35e6ede954326a10949891af2dba47bbe1fc17"

# ⚠️ this wget call will fail if you haven't exported DESIRED_SHA as in the preceding line

> wget -O /tmp/libxmlsec1.rb "https://raw.githubusercontent.com/Homebrew/homebrew-core/${DESIRED_SHA}/Formula/libxmlsec1.rb"

--2023-06-30 11:40:48-- https://raw.githubusercontent.com/Homebrew/homebrew-core/7f35e6ede954326a10949891af2dba47bbe1fc17/Formula/libxmlsec1.rb

Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.108.133, 185.199.109.133, ...

Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 2932 (2.9K) [text/plain]

Saving to: ‘/tmp/libxmlsec1.rb’

/tmp/libxmlsec1.rb 100%[=========================================================================================>] 2.86K --.-KB/s in 0s

2023-06-30 11:40:48 (25.9 MB/s) - ‘/tmp/libxmlsec1.rb’ saved [2932/2932]`

Install the local copy of the last known good formula from /tmp

> brew install --formula /tmp/libxmlsec1.rb

==> Fetching libxmlsec1

==> Downloading https://ghcr.io/v2/homebrew/core/libxmlsec1/manifests/1.2.37

Already downloaded: /Users/daniel/Library/Caches/Homebrew/downloads/0cff6c77c178a7b4826e3146309166ec9d19a0a6580d47e5a1ebaf367cd6c7d0--libxmlsec1-1.2.37.bottle_manifest.json

==> Downloading https://ghcr.io/v2/homebrew/core/libxmlsec1/blobs/sha256:26d6ebddf4e97431819583ad699228360886d81786b332084693d0ad34aa2c72

####################################################################################################################################################################### 100.0%

Warning: libxmlsec1 1.3.1_1 is available and more recent than version 1.2.37.

==> Pouring libxmlsec1--1.2.37.arm64_ventura.bottle.tar.gz

🍺 /opt/homebrew/Cellar/libxmlsec1/1.2.37: 221 files, 6MB

==> Running brew cleanup libxmlsec1...

Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.

Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).

Removing: /Users/daniel/Library/Caches/Homebrew/libxmlsec1--1.2.37... (1.2MB)`