Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphical multiple file-pair comparison on Mac OS 10.7

Tags:

macos

diff

svn

People also ask

Is there a WinMerge for Mac?

WinMerge is not available for Mac but there are plenty of alternatives that runs on macOS with similar functionality. The best Mac alternative is Meld, which is both free and Open Source.


You could use Apple's FileMerge tool, or Kaleidoscope. Both of these have command-line invocations:

  • to open FileMerge, install the command-line developer tools from inside Xcode and use opendiff
  • to open Kaleidoscope, install its command-line tools from inside Kaleidoscope and use ksdiff

KDiff is an open source , visual text difference program. You can use it in windows,unix, linux and Mac OSX . Give it try. On windows , it automatically adds itself for svn diff. I do not use Mac OSX therefore can not say this function is also available there.

compares or merges two or three text input files or directories,

Following image url from kdiff3 site shows that it compare directories.


DiffMerge is both free and great. Also does 3 way comparison and merging.


  1. There is kompare for Mac OS. It is a part of KDE SDK and one can get it using MacPorts:

    sudo port install kdesdk4
    launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
    export PATH="/Applications/MacPorts/KDE4/kompare.app/Contents/MacOS:"$PATH
    

    and it works!

  2. Svn supports so called external diff.

To use it one should create svn-wrapper script, which will take parameters returned by "svn diff" command and call differ with required parameters.

here is an example of parameters "svn diff" returns:

-u -L code/Class1.h (revision 16518) -L code/Class1.h (working copy) code/.svn/text-base/Class1.h.svn-base code/Class1.h

opendiff needs last two. Therefore next bash script will be appropriate:

#!/bin/sh

if [ $# -lt 2 ]; then
    echo "usage: $0 [ignored args...] file1 file2" >&2
    exit 1
fi

# The last two arguments passed to this script are the paths to the files
# to diff.
while [ $# -gt 2 ]; do
    shift
done

exec opendiff $*

put this script in svnwrapper.sh file. Made file executable:

chmod +x svnwrapper.sh

and put it in some common path, which is added to $PATH variable. Now you can call svn using

svn diff --diff-cmd=svnwrapper.sh

or just add at the section [helpers] in ~/.subversion/config file:

diff-cmd = svnwrapper.sh

Kaleidoscope is a really good choice if you want to switch fast from comparing directory structures and files in directories. It is also possible to compare more then 2 copies. I have also impression that the algorithm to compare files (match blocks and colorcode changes) is really good. At the end, a 15 day trial is available, than you need to pay.