Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active December 6, 2024 11:29
Show Gist options
  • Save syneart/4a8724cd479d31f0f742f499f807dcb2 to your computer and use it in GitHub Desktop.
Save syneart/4a8724cd479d31f0f742f499f807dcb2 to your computer and use it in GitHub Desktop.
Meld v3.21.0 (r4) hot-fix for macOS on Intel CPU / Apple Silicon CPU with Rosetta
### Test on https://github.com/yousseb/meld/releases/tag/osx-20
### OSX - 3.21.0 (r4) Sonoma
### !!! Note: You need put the Meld.app r4 build to the /Applications path first.
#!/bin/zsh
#Fix libpng16.16.dylib not found
install_name_tool -change /usr/local/opt/libpng/lib/libpng16.16.dylib @executable_path/../Frameworks/libpng16.16.dylib /Applications/Meld.app/Contents/Frameworks/libfreetype.6.20.0.dylib
#Fix libbrotlidec.1.dylib not found
install_name_tool -change /usr/local/opt/brotli/lib/libbrotlidec.1.dylib @executable_path/../Frameworks/libbrotlidec.1.dylib /Applications/Meld.app/Contents/Frameworks/libfreetype.6.20.0.dylib
#Make MacOS trust Meld.app
xattr -rd com.apple.quarantine /Applications/Meld.app
#Removes the existing code signature
codesign --remove-signature /Applications/Meld.app
#Re-signs with system’s default certificate
codesign --force --deep --sign - /Applications/Meld.app
#if CPU type is Apple silicon, use Rosetta to execute
/usr/libexec/PlistBuddy -c "Set :LSRequiresNativeExecution false" /Applications/Meld.app/Contents/Info.plist
#Try to open Meld
open /Applications/Meld.app
#Meld CLI Setup
curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_setup_cli.sh | zsh
#!/bin/zsh
RC_FILES=( .bashrc .zshrc )
for RC_FILE in "${RC_FILES[@]}"
do
[ -f ~/${RC_FILE} ] && {
( cat ~/${RC_FILE} | grep "alias meld=" ) && {
echo "Already put it at ~/${RC_FILE}"
}|| {
echo "alias meld='meld_script(){ /Applications/Meld.app/Contents/MacOS/Meld \$* 2>/dev/null & };meld_script'" >> ~/${RC_FILE}
. ~/${RC_FILE}
echo "Put it at ~/${RC_FILE} .. ok"
}
}
done
echo "[!] You may need to reopen your Terminal."
1. Download the official **3.21.0 osx4 (r4 pre-release)** [https://github.com/yousseb/meld/releases/tag/osx-20] version.
2. Move the Meld.app file to the /Applications directory.
3. Execute the hot-fix script at CLI with the following command (**only one line**):
`curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh`
@k4u5hik
Copy link

k4u5hik commented Nov 11, 2024

@syneart Thank you. It's working again.

@wim-vds-cegeka
Copy link

@syneart Thanks for sharing this! It solved the crashing issue when running any diff on macOS 15.0 (on M3 Pro).

@ChrisRutledgeSTA
Copy link

A combination of the hotfix command above and running BOTH the code signing commands worked for me; having just downloaded latest meld onto brand-new macBook Pro M4 :)

@AndresRojoInteracso
Copy link

Thank you,
It works for me
M2 Pro Sonora 14.6.1

@Sunac
Copy link

Sunac commented Dec 2, 2024

For macOS 15.1 (24B83)
The application “(null)” does not have permission to open “(null)”.

@k4u5hik, @stevejordi Thank you for the feedback. I have already made adjustments for this issue. You can simply run the hot-fix script again to continue using Meld.app.

-> Execute the hot-fix script at CLI with the following command (only one line): curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

If it still fails, you can go through the process again.

  1. First, Remove the original Meld.app located in the /Applications directory.
  2. And, go to https://github.com/yousseb/meld/releases/tag/osx-20 and download the official 3.21.0 osx4 (r4 pre-release) version.
  3. Move the Meld.app file to the /Applications directory.
  4. Execute the hot-fix script at CLI with the following command (only one line):
    curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

perfect! Thanks. Works like a charm on M1 Sequoia 15.1.1.

@rolandkozma-sg
Copy link

rolandkozma-sg commented Dec 2, 2024

For macOS 15.1 (24B83)
The application “(null)” does not have permission to open “(null)”.

@k4u5hik, @stevejordi Thank you for the feedback. I have already made adjustments for this issue. You can simply run the hot-fix script again to continue using Meld.app.

-> Execute the hot-fix script at CLI with the following command (only one line): curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

If it still fails, you can go through the process again.

  1. First, Remove the original Meld.app located in the /Applications directory.
  2. And, go to https://github.com/yousseb/meld/releases/tag/osx-20 and download the official 3.21.0 osx4 (r4 pre-release) version.
  3. Move the Meld.app file to the /Applications directory.
  4. Execute the hot-fix script at CLI with the following command (only one line):
    curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

@syneart @Sunac Thanks to these, meld works well from both command line and Applications, but I'm not able to configure it as a difftool/mergetool with git. After adding the settings suggested at https://yousseb.github.io/meld/ to .gitconfig, when I execute git difftool, the following error appears on the right side of the window (the left side is loaded ok):
There was a problem opening the file “filepath”.
Error opening file /filepath: No such file or directory
Please help me with the right config.

@bencat-sixense
Copy link

Thanks a lot, you save my day :)

@mcunanan1
Copy link

Thank you so much! Meld is the best tool for the job and you saved the day!

@rolandkozma-sg
Copy link

could anybody provide the right configs for git difftool/mergetool, please?

@liamjones
Copy link

liamjones commented Dec 5, 2024

@rolandkozma-sg

[difftool "meld"]
    cmd = /Applications/Meld.app/Contents/MacOS/Meld "$LOCAL" "$REMOTE" 2>/dev/null

This has been working for me. Though I've been having to blindly answer "Launch meld?" by hitting return. I think that's caused by something else in my terminal/git config setup though.

Edit: oh, and mergetool should be:

[mergetool "meld"]
    cmd = /Applications/Meld.app/Contents/MacOS/Meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED" 2>/dev/null

@rolandkozma-sg
Copy link

Thanks @liamjones!

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