Skip to content

Instantly share code, notes, and snippets.

@alpiepho
Last active June 25, 2024 07:52
Show Gist options
  • Save alpiepho/20f07bf5365bc2617fcf8594b9e4a7f2 to your computer and use it in GitHub Desktop.
Save alpiepho/20f07bf5365bc2617fcf8594b9e4a7f2 to your computer and use it in GitHub Desktop.
Using meld on Mac

More Using Meld merging tool on Mac

After switching to 'Meld for Mac' from download instead of from homebrew, I saw problem again.

The problem is related how the app is closed. If you use the Menu option, the saved state is removed cleaning. If you close using the window close (read circle), the saved state remains. Somehow, when this there, the application will not open from command line. Sometimes it will open, but you need to manually switch to the Meld application from the tool bar.

To work around I added /Applications/Meld.app/Contents/MacOS/meld.wrapper.sh:

#!/bin/sh
rm -rf ~/Library/Saved\ Application\ State/org.gnome.meld.savedState
exec '/Applications/Meld.app/Contents/MacOS/Meld' "$@"

And added the following to my .basch_profile:

alias meld='/Applications/Meld.app/Contents/MacOS/meld.wrapper.sh'

## Background

Meld is a Gnome tool that uses python3 as it's core. It is well supported on Linux, but for Mac there seems to be a single port that is commonly used: Meld for Mac.

When I found my issue with closing the app, I tried to use the build instructions, but could never get this version to build. I think they were written before Meld was moved from github to gitlab. It also seems to require multiple versions of Python (2.7 and 3+) for tools to build meld.


From https://gist.github.com/p1nox/6102015

Works as of 5/23/2019

Using Meld merging tool on Mac

brew tap homebrew/cask
brew cask install meld
  • If meld doesn't start while executing from terminal, try this:

Modify the /usr/local/Caskroom/meld/3.19.2-r6,osx-15/meld.wrapper.sh script installed by brew to the following

#!/bin/sh
rm -rf ~/Library/Saved\ Application\ State/org.gnome.meld.savedState
exec '/Applications/Meld.app/Contents/MacOS/Meld' "$@"

Alternative method (by @yousseb)

If you want to install Meld without brew go to: https://yousseb.github.io/meld/ , this might have a newer version, but the package installed using brew actually comes from this project.

Legacy method (old osx versions)

  1. Install XQuartz

  2. Install meld with brew

     brew install meld
    
  3. Copy PYTHONPATH

     brew info pygtk
    
  4. Paste result of (3) in ~/.bashrc or ~/.zshrc

     export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
    
  5. Set meld as your default git mergetool

     git config --global merge.tool meld
    
  6. Go find your conflicts!

Source: Homebrew/legacy-homebrew#20644

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