Download/Install

The current hledger release is 1.21 (release notes). Below are lots of ways to install:

Binary packages

Multiplatform

Linux, Mac, Windows
docker pull dastapov/hledger
Homebrew
Linux, Mac, WSL
brew install hledger
Nix
Nix
Linux, Mac
nix-env -f https://github.com/NixOS/nixpkgs/archive/915ef210.tar.gz -iA hledger hledger-ui hledger-web
Binaries may not yet be fully cached for your platform, try with --dry-run to estimate how much building will be required. On Linux, note #1030, #1033.
Linux, Mac, *BSD, ...
Install Wine and use the Windows binary below

Windows

CI binaries

Mac

CI binaries

GNU/Linux

CI binaries
Gentoo
Gentoo
sudo layman -a haskell && sudo emerge hledger hledger-ui hledger-web
Arch
Arch
pacman -S hledger hledger-ui hledger-web
Void Linux x86_64
Void
xbps-install -S hledger hledger-ui hledger-web
Debian
sudo apt install hledger hledger-ui hledger-web
Fedora
sudo dnf install hledger
Ubuntu
sudo apt install hledger hledger-ui hledger-web

FreeBSD

freebsd ports
pkg install hs-hledger hs-hledger-ui hs-hledger-web

OpenBSD

pkg_add hledger

Raspberry Pi

Contributed binaries
Contributed binaries

Cloud

Sandstorm

C libraries

On some platforms, certain C library packages must be installed, or you'll see an error (eg: "cannot find -ltinfo") when you try to run prebuilt hledger binaries or build hledger from source. So if you're on one of the following platforms, please run the command shown (and please send improvements for this list):

Debian, Ubuntu:
sudo apt install libtinfo-dev libtinfo5
Fedora, RHEL:
sudo dnf install gmp-devel ncurses-devel

UTF-8 locale

On unix systems, when building or running hledger (and GHC haskell programs in general), the LANG environment variable must be set to a UTF-8-aware locale, or you'll see errors (eg: "invalid byte sequence" or "mkTextEncoding: invalid argument") when processing non-ascii text. Check that LANG's value mentions UTF-8, and if not, change it:

$ echo $LANG
C
$ export LANG=C.UTF-8    # or en_US.UTF-8, fr_FR.utf8, etc.
$ echo $LANG
C.UTF-8

In some cases the locale may need to be installed with your system package manager first. See hledger: Troubleshooting for more help.

Building from source

Release source

The hledger-install script requires only bash and builds the current release of the hledger tools and some add-ons, in a reliable way:

curl -sO https://raw.githubusercontent.com/simonmichael/hledger/master/hledger-install/hledger-install.sh
less hledger-install.sh # <- good practice: inspect downloaded scripts before running
bash hledger-install.sh

This uses the stack or cabal build tools (installing stack in ~/.local/bin if needed), and installs the hledger tools in ~/.local/bin or ~/.cabal/bin.

Or, if you prefer to run stack yourself:

stack update
stack install --resolver=lts-17 hledger-lib-1.21 hledger-1.21 hledger-ui-1.21 hledger-web-1.21 --silent

This installs the main hledger tools in ~/.local/bin. Your stack --version should be not too ancient; use a recent release (2.5.1+) for best results. You can usually upgrade stack quickly with stack upgrade. Windows users: the 64-bit version of stack is preferable; and you should omit hledger-ui from this command, unless you are in WSL.

Or, if you prefer to run cabal yourself:

cabal update
cabal install alex happy
cabal install hledger-1.21 hledger-ui-1.21 hledger-web-1.21

This installs the main hledger tools in ~/.cabal/bin. Your cabal --version should be not too ancient; use a recent release (eg 3.2+) for best results. Windows users: omit hledger-ui from this command, unless you are in WSL.

Or, nix users can use nix-env to build hledger from source (but we try to provide a nix command that installs already-cached binaries.)

Build tips

Building the development version

Latest source

If you want the very latest improvements, our master branch on github is suitable for daily use. Get the source with git:

git clone https://github.com/simonmichael/hledger
cd hledger

and build and install executables to ~/.local/bin with stack:

stack update
stack install

or to ~/.cabal/bin with cabal:

cabal update
cabal install alex happy
cabal install all:exes

hledger development builds show a ".99" suffix in their --version output, so eg "1.17.99" means the in-development version of 1.18.

Building the development version with Docker

You can also build the development version in a Docker container which will take care of pulling all the necessary tools and dependencies:

git clone https://github.com/simonmichael/hledger
cd hledger/docker
./build.sh

This will build the image tagged hledger with just the latest binaries inside. If you want to keep all the build artifacts and use the resulting image for hledger development, run ./build-dev.sh instead.

Check your PATH

After building/installing, you may see a message about where the executables were installed. Eg:

  • with stack: $HOME/.local/bin (on Windows, %APPDATA%\local\bin)
  • with cabal: $HOME/.cabal/bin (on Windows, %APPDATA%\cabal\bin)
  • with nix: $HOME/.nix-profile/bin

Make sure that this install directory is included in your shell's $PATH (preferably near the start, to preempt any old hledger binaries you might have lying around), so that you can run the hledger tools easily. How to configure this depends on your platform and shell. If you are using bash, this will show it:

echo $PATH

and here's a way to add the stack and cabal install dirs permanently:

echo "export PATH=~/.local/bin:~/.cabal/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

Here's how to set environment variables on Windows.

Test your installation

After a successful installation, you should be able to run the hledger tools and see the expected versions (the ones you just installed, and not any older versions that may exist somewhere else in your PATH). Eg:

$ hledger --version
hledger 1.21
$ hledger-ui --version
hledger-ui 1.21
$ hledger web --version
hledger-web 1.21

And you could see the unit tests pass (just for fun):

$ hledger test
...
All 215 tests passed (0.12s)

Or if you have checked out the hledger source, also the functional tests:

$ make functest
Excluding 2 test files

Test Cases Total
Passed 694 694
Failed 0 0
Total 694 694
functest PASSED

Nicely done! Now check the Quick Start for next steps, or come to the #hledger chat where we'll gladly share tips or receive your feedback.