Skip to content

Instantly share code, notes, and snippets.

@mstevenson
Forked from dreness/fix-synalize-it.md
Created August 10, 2022 15:37
Show Gist options
  • Save mstevenson/0b0ff6cc06a094829205cba99cd600f3 to your computer and use it in GitHub Desktop.
Save mstevenson/0b0ff6cc06a094829205cba99cd600f3 to your computer and use it in GitHub Desktop.
A somewhat brutal repair of Synalize It! Pro for macOS, which is broken by linking against the system-provided python which no longer exists.

check current python linkage

% otool -L /Applications/Synalyze\ It\!\ Pro.app/Contents/MacOS/Synalyze\ It\!\ Pro | grep Python
	/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16)

Download and install Python2.7.16 for macOS. By default this lands in /Library/Frameworks/Python.framework/Versions/2.7

Make a copy of the Synalize It! Pro app bundle, e.g. to your desktop.

cp -R /Applications/Synalyze\ It\!\ Pro.app ~/Desktop

Strip the quarantine bit (incase you just downloaded this or something)

xattr -d com.apple.quarantine ~/Desktop/Synalyze\ It\!\ Pro.app

Edit the dyld link path in the Synalize It! binary, so it looks for the python framework where you installed Python2.7. The three arguments after -change are: the link path to replace, the new link path, the path to the binary to edit. If this fails with an error like "killed install_name_tool -change", you are probably using the MAS version of Synalize It!. Don't do that, go get a copy from the website.

% install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.7/Python \
/Library/Frameworks/Python.framework/Versions/2.7/Python \
/Users/andre/Desktop/Synalyze\ It\!\ Pro.app/Contents/MacOS/Synalyze\ It\!\ Pro

Replace the code signature, deeply and with vigor

% codesign -s - --force --deep ~/Desktop/Synalyze\ It\!\ Pro.app

verify python linkage

% otool -L ~/Desktop/Synalyze\ It\!\ Pro.app/Contents/MacOS/Synalyze\ It\!\ Pro | grep -i python
	/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.16)

verify code signature. You're looking for something similar to below, probably not identical.

% codesign -d -v ~/Desktop/Synalyze\ It\!\ Pro.app
Executable=/Users/andre/Desktop/Synalyze It! Pro.app/Contents/MacOS/Synalyze It! Pro
Identifier=com.synalyze-it.SynalyzeItPro
Format=app bundle with Mach-O thin (x86_64)
CodeDirectory v=20400 size=247766 flags=0x2(adhoc) hashes=7736+3 location=embedded
Signature=adhoc
Info.plist entries=41
TeamIdentifier=not set
Sealed Resources version=2 rules=13 files=526
Internal requirements count=0 size=12

Temporarily adjust PATH to remove all other references to any python other than the python2.7 you installed.

% export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

set PYTHONPATH. This is needed because at runtime it will try to load other python modules, and won't look in the right place unless you provide instructions.

% export PYTHONPATH=$(python2 -c 'import sys ; print ":".join(sys.path).lstrip(":")')

verify PYTHONPATH

% echo $PYTHONPATH
/Users/andre/Desktop:/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

Launch the app from the current shell. There are a couple scary looking messages, but it's probably actually running and usable.

% ~/Desktop/Synalyze\ It\!\ Pro.app/Contents/MacOS/Synalyze\ It\!\ Pro
Trace not initialized
Warning: program compiled against libxml 209 using older 207
2022-06-07 21:57:54.158 Synalyze It! Pro[16092:2420880] [AppCenter] WARNING: -[MSAuthTokenContext authTokenHistory]/210 Failed to retrieve history state or none was found.
2022-06-07 21:57:54.158 Synalyze It! Pro[16092:2420880] [AppCenter] WARNING: -[MSAuthTokenContext setAuthTokenHistory:]/225 Failed to save new history state.
...

🎉🍺🌈

To ease the pain slightly, you can make a custom launcher (e.g. saved on your Desktop) that sets the required environment vars and then opens the app. Make a file in your home directory called synalize.command with the following contents, except edit the last line to match the location of your hacked up version of Synalize It! Pro.

#!/bin/zsh

export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PYTHONPATH=$(python2 -c 'import sys ; print ":".join(sys.path).lstrip(":")')
~/Desktop/Synalyze\ It\!\ Pro.app/Contents/MacOS/Synalyze\ It\!\ Pro

Now make that file executable:

% chmod +x ~/synalize.command

... now you can double click that file, and move it to wherever you like. You're done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment