As a haskell package, git-annex can be installed using cabal.

Start by installing the Haskell Platform. In Debian, this is as simple as:

sudo apt-get install haskell-platform

minimal build

This builds git-annex without some features that require C libraries, that can be harder to get installed. This is plenty to get started using it, although it does not include the assistant or webapp.

cabal update
PATH=$HOME/bin:$PATH
cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"

full build

To build with all features enabled, including the assistant and webapp, you will need to install several C libraries and their headers, including libgnutls, libgsasl, libxml2, and zlib. Then run:

cabal update
PATH=$HOME/bin:$PATH
cabal install c2hs --bindir=$HOME/bin
cabal install git-annex --bindir=$HOME/bin

building from git checkout

But maybe you want something newer (or older). Then download the version you want, and use cabal as follows inside its source tree:

cabal update
PATH=$HOME/bin:$PATH
cabal install c2hs --bindir=$HOME/bin
cabal install --only-dependencies
cabal configure
cabal build
cabal install --bindir=$HOME/bin

After finishing the installation the cabal way, here are the packages I installed. It is possible that there are other packages I installed previously as dependency for other packages.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.2 LTS
Release:    12.04
Codename:   precise

$ apt-get install cabal-install libgnutls28-dev libgsasl7-dev c2hs libghc-libxml-sax-dev zlib1g-dev libghc-zlib-dev
$ cabal install git-annex --bindir=$HOME/bin

I get an error from the command as above: $ sudo apt-get install cabal-install libgnutls28-dev libgsasl7-dev c2hs libghc libxml-sax-dev zlib1g-dev libghc-zlib-dev

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.2 LTS Release: 12.04 Codename: precise

If you're installing git-annex with cabal, there is no need to install any haskell library packages with apt-get. That includes libghc-libxml-sax-dev and libghc-zlib-dev. Without those, the apt-get line may work to install the C libraries needed for cabal to install the haskell libraries.

However, see the the Ubuntu page for much easier ways to get git-annex installed.

Comment by http://joeyh.name/ Thu May 30 15:25:29 2013

@Joey Many thanks. I am new to Haskell (vaguely looked at it with DARCS) and git-annex. After installing with apt-get on Ubuntu 12.04 LTS I found webapp was missing, hence have come here. I am going through the correct steps now, it should be awesome when done.

This seems to be a long build process (still going on my old laptop, much longer than apt-get). Ubuntu git-annex packages from 13.10 Saucy I think are updated to include webapp.

Registering yesod-static-1.1.2.3...
Installing library in /home/nrb/.cabal/lib/yesod-static-1.1.2.3/ghc-7.4.1
Registering yesod-static-1.1.2.3...
cabal: Error: some packages failed to install:
c2hs-0.16.4 depends on language-c-0.3.2.1 which failed to install.
dbus-0.10.4 depends on libxml-sax-0.7.4 which failed to install.
git-annex-4.20130521.2 depends on libxml-sax-0.7.4 which failed to install.
language-c-0.3.2.1 failed during the configure step. The exception was:
ExitFailure 1
libxml-sax-0.7.4 failed during the configure step. The exception was:
ExitFailure 1
network-protocol-xmpp-0.4.5 depends on libxml-sax-0.7.4 which failed to
install.

I'm having problems installing from cabal, and it seems related to yesod. I found an older discussion on something similar, where a constraint to require a newer version of yesod had been added, but I haven't figured out what was done to solve it.

The problem seems to be that git-annex requires yesod < 1.2, but cabal is unable to install an older version.

$ cabal install git-annex --bindir=$HOME/bin
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: git-annex-4.20130601
trying: git-annex-4.20130601:+webapp
rejecting: yesod-1.2.1.1, 1.2.1, 1.2.0.1, 1.2.0 (conflict:
git-annex-4.20130601:webapp => yesod(<1.2))
trying: yesod-1.1.9.3
$

From what I can tell, the problem is fixed in github master since yesod >= 1.2 is supported again.

Comment by krig Tue Jun 25 06:14:18 2013
git-annex 4.20130621 once again builds with the current version of yesod.
Comment by http://joeyh.name/ Tue Jun 25 17:16:46 2013
comment 5 8789fc27466714faa5a3a7a6b8ec6e5d
[[!comment Error: unsupported page format txt]]
Fri Jul 26 21:22:39 2013

I had - maybe the same problem as Nigel - with ExitFailure 1 libxml-sax-0.7.4 .

I could fix this by forcing the link of libxml2 package with "brew link libxml2 --force". Maybe you should update your guide. I had this problem on 2 different machines running both the current versions of OS X.

After this the build finished successfull. Maybe this helps.

@Henning; see the OSX page for full installation instructions for OSX. Which include all the neccesary brew incantations.
Comment by http://joeyh.name/ Sat Jul 27 17:49:07 2013
Comments on this page are closed.