Using visdiff

The /Applications/VisualDiffer.app/Contents/Helpers folder contains the executable file visdiff that integrates with VisualDiffer.app.
You can launch visdiff to visually show a comparison of files or folders using the following syntax:

visdiff <left file or folder> <right file or folder>

Note: On versions older than 1.8.0 visdiff is located at /Applications/VisualDiffer.app/Contents/Resources/visdiff

Wait for document close

If you need to wait until the user closes the diff document window (not necessarily quitting the application) associated with the visdiff command, you can pass the switch --wait.

For example

$ visdiff ~/original.txt ~/modified.txt --wait

VisualDiffer.app doesn’t install the terminal application, but you can manually create the link to the shell command.
It requires root access; from a terminal prompt type the command shown below.

$ sudo ln -s /Applications/VisualDiffer.app/Contents/Helpers/visdiff /usr/bin/visdiff

Note: VisualDiffer can’t install the command line tool from its User Interface to comply with Apple’s submission guidelines

macOS sandbox, temporary files and annoying file open panel prompts

VisualDiffer was sandboxed starting from version 1.4.2 and many users found using it very annoying because any comparison prompts to pick folders/files.
This problem was fixed in version 1.4.3 by introducing the so-called “Trusted Paths”; please refer to Trusted Paths for further details.