This is an old post for how I fixed latexdiff on (Ubuntu) Linux in 2016/2017. The preferred method is now this post, but maybe this will still be useful to someone.

The problem

The excellent program latexdiff seems to come pre-installed with Ubuntu (and maybe OSX). In a terminal, try the following:

latexdiff -V

If you see any kind of error, for example::

Unescaped left brace in regex is deprecated...
Unescaped left brace in regex is deprecated...
Unescaped left brace in regex is deprecated...

Then, there is a problem. However, if you see something like:

This is LATEXDIFF 1.1.1  (Algorithm::Diff 1.15 so, Perl v5.18.2)
    (c) 2004-2015 F J Tilmann
Preamble Internal Type UNDERLINE
Preamble Internal Type SAFE
Preamble Internal Type FLOATSAFE
2 and only 2 non-option arguments required.  Write latexdiff -h to get help

then that is better. But, experience has shown that we actually need to test latexdiff with a minimal example.

Alternative instructions for Ubuntu

Previously, I used the instructions below for fixing the installation on Ubuntu, but I think the above steps are better than this.

The problem is that Ubuntu ships with a version that has the error, so we need to remove the 'problem' version and install the new version. This will take a couple of commands.

It seems that this issue has cropped up twice this year (see here and here). Fortunately, the developer is actively working on latexdiff, and has managed to fix the issue each time.

Step 1: uninstall the current version

The following command:

sudo apt-get remove --purge latexdiff

will uninstall latexdiff. Just to check, run:

latexdiff -V

and you should get a message saying that latexdiff is not installed.

Step 2: Clone latest version of latexdiff

Very easy:

mkdir -p ~/build/
cd ~/build/
git clone https://github.com/ftilmann/latexdiff

Step 2: Clone latest version of latexdiff

Then move into the newly created latexdiff folder and see if it works:

cd ~/build/latexdiff
./latexdiff

If you get an error message like the following:

Can't locate Algorithm::Diff.pm in @INC...

then we need to do Step 3. Otherwise, skip to Step 4.

Optional (and not recommended): if you want to be on the same commit as the fix, you can reset to that commit:

git reset --hard a83d9cb 

Step 3: Install Perl Algorithm::Diff

First install the Perl package manager cpanminus:

sudo apt-get install cpanminus

Then we use cpanminus to install the missing Perl package:

sudo cpanm Algorithm::Diff

Now

./latexdiff -V

should work.

Step 4: add new latexdiff to PATH

Simply add the following to the end of your ~/.bashrc file:

export PATH=~/build/latexdiff:$PATH

Step 5: check latexdiff works

Now move to any other folder, and try

latexdiff -V

If you get the correct (non-error) message, you can proceed to use latexdiff or git latexdiff (hopefully) without any problems.