Re-add macOS 12 (and maybe earlier) support to Audacity 4
Problem to be solved
Audacity 4 no longer runs on macOS 12. This seems to be a limitation of the QT 6.10 library used, but it seems to be mostly an artificial limitation that can be relaxed with a single line change to QT.
Your idea
QT can be patched to lower its minimum macOS version required to 12.0 or lower. The check to the version happens in https://github.com/qt/qtbase/blob/v6.10.1/src/corelib/kernel/qcore_mac.mm at qt_apple_check_os_version() function.
I was able to get the app to launch and do a few basic things fine on my computer on 12.7.6 after applying a binary patch to the app, and didn't run into any problems or limitations.
Here is proof that it actually works:
Prior art
No response
Additional context
In the interest of the public, for Audacity 4.0 the binary "band-aid" patch I ran was
mkdir -p "$HOME/Applications"
APP="$HOME/Applications/Audacity 4 Monterey.app"
rm -rf "$APP"
ditto "/Applications/Audacity 4.app" "$APP"
# 2. Extract the arm64 QtCore slice
QTCORE="$APP/Contents/Frameworks/QtCore.framework/Versions/A/QtCore"
TMP="$(mktemp -d)"
lipo "$QTCORE" -thin arm64 -output "$TMP/QtCore.arm64"
lipo "$QTCORE" -thin x86_64 -output "$TMP/QtCore.x86_64"
# 3. Change Qt's compiled runtime requirement: 13.0 → 12.0
# Original bytes at arm64 offset 0x21cd80: e8 a0 81 52
# Patched bytes: e8 80 81 52
printf '\xe8\x80\x81\x52' |
dd of="$TMP/QtCore.arm64" bs=1 seek=$((0x21cd80)) conv=notrunc
# 4. Reassemble the universal framework binary
lipo -create "$TMP/QtCore.x86_64" "$TMP/QtCore.arm64" -output "$QTCORE"
# 5. Re-sign the modified framework and application
codesign --force --sign - "$QTCORE"
codesign --force --deep --sign - "$APP"
codesign --verify --deep --strict --verbose=2 "$APP"
# 6. Launch it
xattr -dr com.apple.quarantine "$APP"
open "$APP"I understand this isn't a feasible way to fix future versions automatically, but it serves as a proof of concept that it is, at least to some degree, possible. My hopes are just to allow for a greater audience to enjoy the cool new features added in Audacity 4.
Source: audacity/audacity