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

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

I tried various ways to install git-annex on my TonidoPlug.

System Info:

root@TonidoPlug2:~# uname -a
Linux TonidoPlug2 2.6.31.8-topkick1281p2-001-004-20101214 #1 Thu Jun 16 10:06:20 CST 2011 armv5tel GNU/Linux

apt-get didn't work.

root@TonidoPlug2:~# apt-get install git-annex
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package git-annex

The Linux standalone installation results in an error message like this, when calling git-annex (or git annex)

~$ git-annex.linux/git-annex
/home/gitolite/git-annex.linux/bin/git-annex: 1: Syntax error: ")" unexpected

(git-annex.linux/bin/git-annex is a binary file and works fine on other distros)

When installing with cabal, I get the error message (tried as root and gitolite user)

~$ cabal install git-annex --bindir=$HOME/bin -f"-assistant -webapp -webdav -pairing -xmpp -dns"
Resolving dependencies...
cabal: cannot configure git-annex-4.20130802. It requires base >=4.5 && <4.8
For the dependency on base >=4.5 && <4.8 there are these packages:
base-4.5.0.0, base-4.5.1.0, base-4.6.0.0 and base-4.6.0.1. However none of
them are available.
base-4.5.0.0 was excluded because of the top level dependency base -any
base-4.5.1.0 was excluded because of the top level dependency base -any
base-4.6.0.0 was excluded because of the top level dependency base -any
base-4.6.0.1 was excluded because of the top level dependency base -any

Any help is appreciated. Thanks for providing git-annex. I started cleaning up my backups with it yesterday and really like it.

The Linux standalone builds for i386 and amd64 will not work on Arm systems.

There are builds of git-annex for arm in eg, Debian. You should be able to use one of those if this system is running Debian. You may need to upgrade to eg, Debian stable, which includes git-annex.

It looks like you have an old and/or broken GHC compiler too. You could upgrade that to a newer version (eg from Debian stable) and build it that way, but it seems like the long way around if you have a Debian system there.

Comment by http://joeyh.name/ Wed Aug 7 16:31:30 2013
@Joey Thanks for the answer. I didn't want to mess around too much with the TonidoPlug. I am currently setting up a raspberry pi, which works fine.

I had problems following these directions on recent releases of Fedora/Ubuntu. The install attempts failed on cryptocipher-0.3.1, which I think came as a dependency of Yesod. I was able to work around this by installing yesod-platform with cabal first, then installing git-annex.

I'd like to use the assistant's power on a Raspberry Pi to build an always-on file/sync server. Is there a way to get the assistant running on Arm? I know there's a Debian package, but it's Version 3.20120629 and comes without the assistant. Has anyone ever successfully built a recent git-annex version on Arm? What would I need in order to do it myself?
Comment by RaspberryPie Fri Aug 23 03:07:11 2013

The git-annex assistant can easily be built on arm. But not the webapp. It's entirely possible to use the assistant without the webapp though; you just have to make the git repository and configure the remotes by hand, and then the assistant will sync them the same way the webapp does.

It is possible but very involved to build the webapp for arm. I do not anticipate doing it in the Debian package until ghc gets proper template haskell support for arm. See Webapp on ARM

Comment by http://joeyh.name/ Fri Aug 23 17:37:52 2013

Thanks for the quick answer. I will try to build git-annex with just the assistant, as you suggest, and once it works set up the server by hand as you suggest.

BTW: Awesome job you're doing with git-annex. I appreciate your enthusiasm.

Comment by RaspberryPie Fri Aug 23 18:51:51 2013
comment 5 8789fc27466714faa5a3a7a6b8ec6e5d
[[!comment Error: unsupported page format txt]]
Tue Aug 27 20:23:35 2013
Comments on this page are closed.