After upgrading to MacOS Mojave, my git and opendiff stopped working (my opendiff is usually invoked by git diff).
I was able to get git working, by using the following two lines:
xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools
but opendiff and git diff still doesn't work. It seems one solution is to install the Xcode app, which is huge (said to be taking up 10GB on the hard drive). I checked Spotlight and typed FileMerge, and was able to find it, which should be the same as opendiff, and was able to use ps ax to find the path /Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge. But then, using git diff, I actually used a bash script to invoke
#!/bin/sh
/usr/bin/opendiff "$2" "$5" -merge "$1" | cat
(see this github article about how to set up git-diff-cmd.sh)
so I changed that second line to:
/Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge "$2" "$5" -merge "$1" | cat
but it doesn't work. So FileMerge exists, and it looks like opendiff is FileMerge. Can git diff be made to work without needing to install the whole Xcode app?
This may seem like a hack, and in fact it seems like it is using an existing installation of XCode:
I did
and was able to find
The first file is a binary file, and the second one is actually a script, so I changed my bash script
git-diff-cmd.shto the following:and
git diffcan successfully invokeopendiffto do a visual diff.