It is very helpful to be able to compare different code files to see their changes, specially when working in a team. Adobe Dreamweaver is my main choice when developing since I like the color highlighting theme, it has an FTP client included and a simple check-in/check-out functionality that doesn’t need to be set up like SVN and works in cheap shared hostings that don’t support any version control.
To compare files in Macintosh there are several applications and the best, lighter and faster to load is DiffMerge (works great in my old white Macbook), it is also free and open source so more than welcome. This is how you set it up in Dreamweaver so that you can compare files easily by right-clicking the file and selecting Compare with Remote Server:
Also when uploading a file Dreamweaver may warn you that the file in the server has been modified and you may overwrite someone else’s changes:
And also in the Synchronize files list:
It becomes really useful to see what has changed, once you click the Compare button this is how DiffMerge looks like:
Looks good, huh? Let’s get to work then!
Setting up DiffMerge with Dreamweaver
First thing to do is to download DiffMerge from the official site and install it, no need to open it.
Dreamweaver needs a shell command to open DiffMerge with both files. We will install a small script (10 lines of code) into the /usr/bin folder. To do this you first need to be able to view all hidden files:
defaults write com.apple.Finder AppleShowAllFiles YES killall Finder
Open Finder, go to Utilities and open Terminal. Paste the code above. Finder will restart and all your Finder open windows will close. If the code above doesn’t work then change YES to TRUE and try again.
Now go to Macintosh HD or your main drive and go to usr/bin:
Download this file and rename it as diffmerge.sh
Move diffmerge.sh to the /usr/bin folder, you will probably need to enter your Administrator password since that is a system folder.
Now go to Dreamweaver, open Preferences and go to the File Compare section. In there, paste this text:
Macintosh HD:usr:bin:diffmerge.sh
Yes, it’s got :
instead of /
but it’s how it works.
Save the settings by clicking OK at the bottom.
You are done! Now you can compare files and see what has changed, great to keep track of your peer changes and even some changes you made months ago and can’t remember.
You can hide the hidden files again by going to Terminal and typing:
defaults write com.apple.Finder AppleShowAllFiles NO killall Finder
Nice! You made it until the end of the post. Here’s an extra gift for you, a very useful tool to disable or customize the annoying startup sound in all Mac OSX, it is called Startup Sound and it installs in the System Preferences so it gets completely integrated with your system. It’s free too, download here.
4 comments
Jan says:
One step potentially missing depending on diffmerge.sh was copied: It needs to have execute permission. So it may be necessary to type chmod 777 diffmerge.sh after copying the file.
Joat says:
If you would like to use the FileMerge tools that comes with Xcode from Apple, just replace the lines in the file diffmerge.sh with the following two lines:
#!/bin/sh
exec /usr/bin/xcrun opendiff “$@”
That should do it if you have Xcode installed.*
–JM
*If you don’t see the file /usr/bin/xcrun you need to install the Xcode command line tools:
(a) Install the free Xcode app from Apple’s App Store [https://itunes.apple.com/us/app/xcode/id497799835]
(b) Open Xcode
(c) Go to “Xcode > Preferences > Downloads” and install the “Command Line Tools”
(d) Quit Xcode