Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active November 15, 2024 15:08
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`
@syneart
Copy link
Author

syneart commented Jan 14, 2024

I feel like this should also link to the relevant issue: yousseb/meld#151 (comment)

Yes, you are right. And hope this script snippet can help everyone.

@kanatos92
Copy link

It works like a charm, thanks @syneart
For people who don't read the comment lines (like me), this is for Meld v3.21.0 (r4). The "latest dmg" at Meld for OSX points to Meld v3.21.0 (r2), for which I think the script might work as well if substituting "libfreetype.6.dylib" for "libfreetype.6.20.0.dylib", but I have not tried it.

@AgilentGCMS
Copy link

AgilentGCMS commented Feb 3, 2024

Use below command to hotfix the Meld v3.21.0 (r4) from https://github.com/yousseb/meld/ on your own MacOS Sonoma. curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

Thanks a lot! Success right away.:)

Ditto! Even though the meld app icon had a big circle with a diagonal slash icon when I opened the dmg file, as if it was for the wrong OS, applying the hotfix made it work. Thanks @syneart!

@Burkazoid
Copy link

Thank you so much for this - worked perfectly on latest Mac with the version of Meld linked in the gist.

@sylviaegn
Copy link

THANK YOU !!!!

@syneart
Copy link
Author

syneart commented Mar 2, 2024

It works like a charm, thanks @syneart For people who don't read the comment lines (like me), this is for Meld v3.21.0 (r4). The "latest dmg" at Meld for OSX points to Meld v3.21.0 (r2), for which I think the script might work as well if substituting "libfreetype.6.dylib" for "libfreetype.6.20.0.dylib", but I have not tried it.

Thank you for your feedback. :)
In fact, making the corresponding modifications is not a problem. However, there may be some unknown issues when using the r2 version on macOS Sonoma. We'll have to wait and see what the author's next strategy is.

@msbahal
Copy link

msbahal commented Mar 5, 2024

Thank you! This is such a lifesaver! Worked perfectly on M1 Mac.

@mvasilkov
Copy link

This is glorious, thank you so much!

Meld is such a great app, but installing it got ridiculously hard at this point...

@yosepg
Copy link

yosepg commented Apr 2, 2024

It works like a charm, thanks @syneart For people who don't read the comment lines (like me), this is for Meld v3.21.0 (r4). The "latest dmg" at Meld for OSX points to Meld v3.21.0 (r2), for which I think the script might work as well if substituting "libfreetype.6.dylib" for "libfreetype.6.20.0.dylib", but I have not tried it.

thank you so much for enlighten me because I'm using Meld v3.21.0 (r2) and it doesn't work.
change it to Meld v3.21.0 (r4) now it works like charm..

thanks for the author @syneart

@robwilkerson
Copy link

robwilkerson commented Apr 25, 2024

I get a different error on a M3 silicon mac: Screenshot 2024-01-09 at 4 34 06 PM

I'm seeing the same thing on my work laptop (M1 chip). It looks like the r4 build may not be signed and my org has a policy that doesn't allow unsigned apps to be installed. Does that track with anyone else's understanding or experience?

If that's accurate, then the r2 release must be signed because it opens just fine. Is there any way to port this script so that it works for the r2 release as well?

@syneart
Copy link
Author

syneart commented May 2, 2024

I get a different error on a M3 silicon mac: Screenshot 2024-01-09 at 4 34 06 PM

I'm seeing the same thing on my work laptop (M1 chip). It looks like the r4 build may not be signed and my org has a policy that doesn't allow unsigned apps to be installed. Does that track with anyone else's understanding or experience?

If that's accurate, then the r2 release must be signed because it opens just fine. Is there any way to port this script so that it works for the r2 release as well?

Hi, If you are unable to use command to make MacOS trust, you can try the manual method.

or just use below command to hotfix the Meld v3.21.0 (r4). Note: you need put the Meld.app r4 build to the /Applications path first.
curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

Looking forward to hearing good news from you.

@robwilkerson
Copy link

Can confirm that this removes the untrusted aspect of r4! Still doesn't let me diff directories or files from the command line, which is unfortunate, but it's something...

@syneart
Copy link
Author

syneart commented May 3, 2024

Can confirm that this removes the untrusted aspect of r4! Still doesn't let me diff directories or files from the command line, which is unfortunate, but it's something...

According to the original functionality of the author, you can try the following alias commands I've created.

alias meld='meld_script(){ /Applications/Meld.app/Contents/MacOS/Meld $* 2>/dev/null & };meld_script'

And then try to use it in the same terminal, such as,

meld --diff /tmp /tmp ~/Pictures --diff /tmp ~/Documents

I've also added this functionality to this gist, you can just Overwrite with the original file and rerun the below script.

curl https://gist.githubusercontent.com/syneart/4a8724cd479d31f0f742f499f807dcb2/raw/meld_hotfix_sonoma.sh | zsh

Hoping it can help everyone.

@robwilkerson
Copy link

Updated my alias and I no longer get the error because of the redirection. The alias does launch meld, but it's an empty launch. Nothing actually being diffed.

meld ./.github/workflows/ ./.github/workflows/
[2] 79913

I haven't had a chance to mess with it much and will try to do so more today, but thanks for all of the work on this!

@robwilkerson
Copy link

My bad! I had double quotes in my alias. When I changed it to single, it's all good. This is genuinely huge for me. Thank you again!

@robwilkerson
Copy link

Can confirm that these steps work, @syneart , thank you again! I can launch app and, from the command line, diff both files and directories. Your patch seems to give me everything I really expect from Meld, so I'm crazy happy that I don't have to start using diffmerge or something else that just isn't as good.

@sowmyy
Copy link

sowmyy commented Jun 28, 2024

Works like a charm !!! thanks much :)

@k4u5hik
Copy link

k4u5hik commented Aug 18, 2024

@syneart Thanks Legend! Worked perfectly.

@timbaileyjones
Copy link

Thank you as well. Your workaround enabled me to run Meld on my M3 Pro running 14.6.1!

@barendgehrels
Copy link

On my M1 Pro arm64 I don't get it to work.
The current fatal error seems to be '/usr/local/opt/libpng/lib/libpng16.16.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

I don't have these dylib's in my path. I find 3 and they all report (with file):
/usr/local/opt/libpng/lib/libpng16.16.dylib: Mach-O 64-bit dynamically linked shared library arm64

I tried variants of /usr/libexec/PlistBuddy -c "Set :LSRequiresNativeExecution false" /Applications/Meld.app/Contents/Info.plist , and true,
but without success (I didn't know this command before)

@syneart
Copy link
Author

syneart commented Aug 26, 2024

On my M1 Pro arm64 I don't get it to work. The current fatal error seems to be '/usr/local/opt/libpng/lib/libpng16.16.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

I don't have these dylib's in my path. I find 3 and they all report (with file): /usr/local/opt/libpng/lib/libpng16.16.dylib: Mach-O 64-bit dynamically linked shared library arm64

I tried variants of /usr/libexec/PlistBuddy -c "Set :LSRequiresNativeExecution false" /Applications/Meld.app/Contents/Info.plist , and true, but without success (I didn't know this command before)

  1. First, go to https://github.com/yousseb/meld/releases/tag/osx-20 and download the official 3.21.0 osx4 (r4 pre-release) 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

@barendgehrels
Copy link

On my M1 Pro arm64 I don't get it to work. The current fatal error seems to be '/usr/local/opt/libpng/lib/libpng16.16.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))
I don't have these dylib's in my path. I find 3 and they all report (with file): /usr/local/opt/libpng/lib/libpng16.16.dylib: Mach-O 64-bit dynamically linked shared library arm64
I tried variants of /usr/libexec/PlistBuddy -c "Set :LSRequiresNativeExecution false" /Applications/Meld.app/Contents/Info.plist , and true, but without success (I didn't know this command before)

  1. First, go to https://github.com/yousseb/meld/releases/tag/osx-20 and download the official 3.21.0 osx4 (r4 pre-release) 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

Tried again. And wow, that works now! 🎉 I earlier applied these steps individually and must have done something wrong there (first time I tried r2 then I tried to search for paths).
Thanks a lot! ❤️ very glad to use it again.

@Ood-Tsen
Copy link

It works like a charm, thanks @syneart For people who don't read the comment lines (like me), this is for Meld v3.21.0 (r4). The "latest dmg" at Meld for OSX points to Meld v3.21.0 (r2), for which I think the script might work as well if substituting "libfreetype.6.dylib" for "libfreetype.6.20.0.dylib", but I have not tried it.

It's work on M2 Mac too.

@k4u5hik
Copy link

k4u5hik commented Nov 10, 2024

Any update for macOS 15.1 (24B83)?

I am getting the following error.

The application “(null)” does not have permission to open “(null)”.

@stevejordi
Copy link

Same for me. It worked fine in 15.0 but in 15.1 it says "The application Finder does not have permission to open null" when double-clicked from Applications, and if from the launchpad it says ""The application Dock does not have permission to open null"

@syneart
Copy link
Author

syneart commented Nov 11, 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

@k4u5hik
Copy link

k4u5hik commented Nov 11, 2024

@stevejordi I too got those errors

"The application Finder does not have permission to open null" or
"The application Dock does not have permission to open null"

Removing the signature of the app and self-signing it solved the problem.

codesign --remove-signature /Applications/Meld.app
codesign --force --deep --sign - /Applications/Meld.app

@k4u5hik
Copy link

k4u5hik commented Nov 11, 2024

@syneart Thank you. It's working again.

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