Skip to content

Instantly share code, notes, and snippets.

@chrisbloom7
Created September 29, 2010 18:05
Show Gist options
  • Save chrisbloom7/603203 to your computer and use it in GitHub Desktop.
Save chrisbloom7/603203 to your computer and use it in GitHub Desktop.
Bash shell script to use Beyond Compare from Versions.app
#!/bin/bash
# This script will open a file compare dialog for files you select in Versions.app. This script requires
# Beyond Compare to be installed into CrossOver for Mac. Note that the BC window doesn't always open
# in the foreground nor does it appear in the Dock, so you will need to CMD-TAB to find it. If you have problems
# using this from Versions try executing the commands below in a normal Terminal window running bash and replace
# the $1 and $2 variables with complete paths to two existing files.
# Setup some variables that CrossOver will need. You should replace these with your own values which can
# be found by opening CrossOver, going to Programs -> Run Command, selecting the bottle you installed
# Beyond Compare into, and then clicking the Open Shell button under the Debug Options section.
export 'VERSIONER_PERL_PREFER_32_BIT'='yes'
export 'Apple_PubSub_Socket_Render'='/tmp/launch-WO9Ksw/Render'
export 'FONT_ENCODINGS_DIRECTORY'='/Applications/CrossOver.app/Contents/SharedSupport/X11/lib/X11/fonts/encodings/encodings.dir'
export 'DISPLAY'=':2'
export 'TMPDIR'='/var/folders/ZO/ZOy8FJSGGbGExN3lEijAs++++TI/-Tmp-/'
export 'COMMAND_MODE'='legacy'
export 'DYLD_FALLBACK_LIBRARY_PATH'='/Applications/CrossOver.app/Contents/SharedSupport/X11/lib:/Users/chrisbloom7/lib:/lib:/usr/lib:/usr/X11/lib'
export 'CX_BOTTLE_PATH'='/Users/chrisbloom7/Library/Application Support/CrossOver/Bottles'
export 'FONTCONFIG_ROOT'='/Applications/CrossOver.app/Contents/SharedSupport/X11'
export 'SSH_AUTH_SOCK'='/tmp/launch-WqnyYv/Listeners'
export 'LANG'='en_US.UTF-8'
export 'FONTCONFIG_PATH'='/Applications/CrossOver.app/Contents/SharedSupport/X11/etc/fonts'
export CX_BOTTLE='Beyond Compare'
export PATH="$PATH:"'/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin'
cd '/Users/chrisbloom7/Library/Application Support/CrossOver/Bottles/Beyond Compare/drive_c'
# END variable setup
# Make sure CrossOver is running. This shoud have no effect if it is already open.
open /Applications/CrossOver.app
# Call BC with the files passed from Verions
wine --cx-app BCompare.exe -- "$1" "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment