FileMerge fails on OS X 10.7 and Xcode 4.2
Problem
The FileMerge option cannot be performed.
Diagnosis
Environment
- Mac OS X 10.7 - Lion
- Xcode 4.2
Cause
When installing Xcode 4.2, the opendiff
command line tool is moved from /usr/bin
to /Developer/usr/bin
. However, the path to the command is not added to the PATH list and this causes to command to fail.
Resolution options
Resolution 1
Create a symbolic link to the new location of the opendiff
command
sudo ln -s /Developer/usr/bin/opendiff /usr/bin/opendiff
Resolution 2
Add /Developer/usr/bin
to your path. You will need to do this in two locations:
- /etc/paths - this is the $PATH that the SourceTree user interface uses (Note: a computer restart may be required for this change to be effective)
- Your ~/.bash_profile or similar
Additional resolution option
It may still occur, that the command is still failing after having applied one of the option above.
If this is the case, try running the opendiff
command from the command line, in case you get a response like the following:
xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.
then run this command on the terminal:
sudo xcode-select -switch /Developer
After this step, the opendiff
command, as well as the SourceTree FileMerge, should be working as expected.