6

I'm wondering if there is a way to use FileMerge as a standalone tool. I don't want to install Xcode, since I don't need it. I just want the FileMerge app. Is that possible?

8

FileMerge 2.8, which ships with Xcode 5.0.1 links to frameworks that are located inside of the Xcode.app bundle. Shared libraries that are used by FileMerge can be displayed by performing the command:

otool -L /Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge

The output of this command indicates that FileMerge needs to use the DevToolsInterface, DevToolsCore, and DevToolsFoundation frameworks. :

/Applications/Xcode.app/Contents/Applications/FileMerge.app/Contents/MacOS/FileMerge:
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1247.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1052.0.0)
    @rpath/DevToolsInterface.framework/Versions/A/DevToolsInterface (compatibility version 1.0.0, current version 3000.1.0)
    @rpath/DevToolsCore.framework/Versions/A/DevToolsCore (compatibility version 1.0.0, current version 2404.0.0)
    @rpath/DevToolsFoundation.framework/Versions/A/DevToolsFoundation (compatibility version 1.0.0, current version 3001.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 852.0.0)

The prefix @rpath indicates that dyld will use the run path list to search for frameworks that are being referenced. Specifically, FileMerge contains "../OtherFrameworks" in its run path list. When located inside of the Xcode.app bundle, those frameworks are right where FileMerge expects them to be.

However, if you copy FileMerge out of the Xcode.app bundle, FileMerge will crash upon launch. This occurs because the referenced frameworks (referenced above) are not in the run path list, which causes dyld to exit with an error of "image not found". The reason it cannot find those referenced frameworks is that a folder at the relative path "../OtherFrameworks" does not exist, and the frameworks do not exist in any other folders listed in the run path.

To use FileMerge without the Xcode app installed, you have a couple of options:

  1. Copy FileMerge to the location of your choosing, and copy the contents of /Applications/Xcode.app/Contents/OtherFrameworks/ to one of the folders referenced in the run path list (~/Library/Frameworks or /Library/Frameworks are probably a couple of the best choices).

  2. Copy FileMerge to the location of your choosing, and copy the contents of /Applications/Xcode.app/Contents/OtherFrameworks/ to be at "../OtherFrameworks" relative to the FileMerge app (e.g., if FileMerge is at ~/Applications, copy the folder "OtherFrameworks" to ~/OtherFrameworks

Edit

The above answer allows FileMerge to launch, but the application will terminate when you actually attempt to compare files. Apparently the application is looking for platform information at the path ../Developer/Platforms/MacOSX.platform/Info.plist. This means that it is necessary to copy Info.plist from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist to ../Developer/Platforms/MacOSX.platform/Info.plist (relative to FileMerge.app). Here are some steps that could be used to copy FileMerge to a folder at ~/Applications:

mkdir ~/Applications
cp -R /Applications/Xcode.app/Contents/Applications/FileMerge.app ~/Applications

cp -R /Applications/Xcode.app/Contents/OtherFrameworks/* ~/Library/Frameworks

mkdir -p ~/Developer/Platforms/MacOSX.platform
cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist ~/Developer/Platforms/MacOSX.platform
  • Copying Info.plist don't work with XCode 6.1.1 and FileMerge 2.8 in my case — still getting this error: FileMerge[12429:1615479] [MT] ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-6000/pbxcore /SpecificationTypes/XCPlatformSpecification.m:438 Details: The Mac OS X platform is missing - cannot set a default platform. Object: <XCPlatformSpecification> Method: +loadAllPlatforms Thread: <NSThread: 0x7fe4597135f0>{number = 1, name = main} Moving away this file from original FileMerge causes identical error. File owner and rights identical. – Dmitry Verkhoturov Jan 5 '15 at 14:55
  • Was this ever completed successfully? – Jess Riedel Sep 28 '17 at 13:12
  • 1
    @Jess Riedel - this used to work in 2013, but after recently testing, it appears that FileMerge and its supporting libraries/frameworks are linked to over 20 libraries/frameworks within the Xcode.app bundle. That means that it would be necessary to relocate those frameworks/libraries into the run path, and then maintain those (copied) frameworks/libraries as Xcode versions change... I'm not sure why simply making a symlink to FileMerge isn't sufficient for most people? Why is it necessary to move FileMerge outside of the Xcode.app bundle? – Eddie Kelley Sep 28 '17 at 21:19
  • Thanks Eddie. I'm not a developer and was just hoping to try out FileMerge as a tool for diffing TeX files with revisions from different authors. It's not really worth if for me if I need to install and maintain a huge (multi-gigabyte?) installation, although maybe I'm confused about what's involved. – Jess Riedel Sep 28 '17 at 21:33
  • 1
    @Jess Riedel - From what I can see, there's about 700MB of supporting frameworks/libraries, and the "Platforms" folder (containing information/resources for the OS platform you're running on) takes up over 400MB, so it looks like FileMerge would require about 1.5GB of space (and would be kludgy to maintain an prone to failure). It's quite a bit less than Xcode's >9GB install footprint, but not certain if it would be feasible given the 'hacks' that are needed to allow it to function correctly. – Eddie Kelley Sep 28 '17 at 21:41
-3

Yes, this is possible.

Open your Finder and search for XCode.app. Right click and then "Show Package Contents". You'll find a folder called "Applications". Now drag File Merge out of it and you can delete Xcode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .