Finding a good (free) diff tool is hard for OS X. Here, we’ll setup Meld (a popular diff tool on linux) to run with OS X and git.

First, install a decent Mac build of Meld, there’s a few options but here’s one I really like:

Once this is installed, you need to make bash script so Meld is command-line executable and can be invoke through git. Name this file ‘meld’ and place it in a sourced directory that you can run commands from globally. I like to set up a ~/bin directory where I can put scripts like this and magerun so I can run them from anywhere, but you may have a better place for it on your system. You can source a directory by adding the following to the bottom of your ~/.zshrc or ~/.bash_profile:

export PATH="/Users/User/bin:$PATH"

Create a ‘meld’ file in this directory and use the following contents:

$ cat ~/bin/meld

  import sys
  import os
  import subprocess
  if len(sys.argv) > 1:
    left = os.path.abspath(sys.argv[1]);
    left = ""
  if len(sys.argv) > 2:
    right = os.path.abspath(sys.argv[2]);
    right = ""
  if len(sys.argv) > 3:
    merged = os.path.abspath(sys.argv[3]);
    merged = ""
  MELDPATH = "/Applications/"
  arguments = " -n " + MELDPATH + " --args " + left + " " + merged + " " + right
  p =['open', '-W', '-a',  MELDPATH, '--args', left, merged, right])

And finally, add the following to your ~/.gitconfig ~~~ [mergetool “meld”] cmd = meld "$LOCAL" "$REMOTE" "$MERGED" trustexitcode = true ~~~

And give it a shot!