For mac users, brew install hledger should work. This was blocked by homebrew's policy in the past, let's find that discussion and see if we can make it happen.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Discussion here: https://github.com/Homebrew/homebrew/pull/4430 . Their policy has changed, so we just need someone to have another go at it.
Here's a homebrew recipe which works for me:
require "language/haskell"
class Hledger < Formula
include Language::Haskell::Cabal
desc "The hledger accounting tool, command-line version"
homepage "http://hledger.org"
url "http://hackage.haskell.org/package/hledger-0.27/hledger-0.27.tar.gz"
sha256 "0aecdf586a46c24d6d67659157d1edbfc0d78afb50ea7cfbec1a01bf86b792b0"
# head "https://github.com/simonmichael/hledger.git"
bottle do
sha256 "56c7bb47a4a0f3014c734fd65c7b44b060313bfef54a5c06462b56ee000df970" => :el_capitan
sha256 "ecfa1ad7312544f079496d428fb7c3a16bed77206a218e98bce0ade2fe5ffa9e" => :yosemite
sha256 "ef597e53f05f99f84309b300ccf573d339cf0809537bcd665c5e980c3ad2f88a" => :mavericks
end
depends_on "ghc" => :build
depends_on "cabal-install" => :build
def install
install_cabal_package :using => ["happy"]
end
test do
system "#{bin}/hledger", "test"
end
end
I've been following the Formula Cookbook. Perhaps it's good to retrace my steps:
brew updatebrew create http://hackage.haskell.org/package/hledger-0.27/hledger-0.27.tar.gzbrew install --verbose --debug hledgerbrew audit --strict --online hledgerand now proceed with Commit...
I think the bottle lines will be updated automatically by homebrew.
Using the above instructions and formula from @simonmichael, I've created a pull request for Homebrew for hledger:
brew install hledger now works! Thanks, @travisbhartwell !
Our next priority is to get hledger-ui and hledger-web into homebrew. We're not sure how to do this with the one formula, so while that might be convenient for users, we may end up making one brew formula per hledger package. Advice welcome.
Is there an update on this front? I've installed hledger with brew but only ended up with core hledger, and there can't seem to be any way to get hledger-ui and hledger-web other than by installing from source with cabal (and ending up with a huge deployment of cabal-related stuff). Is there any way to install hledger-ui and hledger-web on OS X as binary packages?
No progress on this; we still need a homebrew packager.
Building from source is pretty easy these days - just follow the instructions on the download page. Once the binaries are installed in ~/.local/bin you can certainly rm -rf ~/.stack ~/hledger if the disk usage is a concern.
Although it is easy to install from source, it would be nice to use brew to install all the optional packages as well. I typically go to brew for my default installs, but install from source if absolutely needed (just easier to stay up-to-date that way).
Seems like we just need to tweak this line a bit:
install_cabal_package :using => ["happy"]
https://github.com/Homebrew/homebrew-core/blob/master/Formula/hledger.rb
I don't know enough about homebrew and cabal to tweak that file though :)
Thanks for this project @simonmichael!
I thoroughly agree. Please do experiment. Between us, I'm sure we can figure it out. Maybe some of the other haskell homebrew recipes will give ideas ?
@travisbhartwell any ideas on how to add the other packages ?
I briefly perused https://github.com/Homebrew/homebrew-core/search?utf8=%E2%9C%93&q=install_cabal_package&type= but wasn't having much luck. I'm too unfamiliar with cabal.
Here's the source for install_cabal_package.
It looks like you can pass arguments something like this:
install_cabal_package "hledger", "hledger-ui", "hledger-web", "hledger-api" :using => ["happy"]
But, that url declaration suggests it'll download only one of the packages.
subformulas might be the answer.
What about formulas for hledger-ui & hledger-web?
Hi, I know absolutely no Ruby, but here is a formula installing hledger-ui and hledger-web based on the resources you linked which seems to work for me on Mojave at least:
require "language/haskell"
class HledgerUi < Formula
include Language::Haskell::Cabal
desc "The Curses UI for hledger, the accounting tool"
homepage "http://hledger.org"
url "http://hackage.haskell.org/package/hledger-ui-1.11.1/hledger-ui-1.11.1.tar.gz"
sha256 "924988e477b968ca6c17e57431614f6032c114265a7d3ab03d4d4c2ff516660e"
resource "hledger_web" do
url "http://hackage.haskell.org/package/hledger-web-1.11.1/hledger-web-1.11.1.tar.gz"
end
depends_on "ghc" => :build
depends_on "cabal-install" => :build
def install
install_cabal_package"hledger-ui", "hledger-web", :using => ["happy", "alex"]
end
test do
system "#{bin}/hledger-ui", "test"
end
end
So in other words, what was needed to add more Cabal packages was a resource declaration for that package (this one needs a SHA sum):
resource "hledger_web" do
url "http://hackage.haskell.org/package/hledger-web-1.11.1/hledger-web-1.11.1.tar.gz"
end
and then more arguments to install_cabal_package (note the comma before the keyword argument, it was missing from @simonmichael's comment above)!
Thanks @albins !
It looks like you've made a separate formula for hledger-ui, that also installs hledger-web. Would you have some time to try merging these (and hledger-api if easy) into the existing hledger formula ?
@simonmichael That's correct, but the principle would be identical when extending the existing package. I'd be happy to extend the existing formula, but I have no idea how to proceed with integrating it into Homebrew.
Great! I'm not sure either, let's see.. http://hledger.org/download.html, a., Mac, Formula code on github, https://github.com/Homebrew/homebrew-core/blob/master/Formula/hledger.rb - you just send a pull request to this.
Ok, I'm working on it!
Here is the PR: https://github.com/Homebrew/homebrew-core/pull/35727
Terrific. The current release is 1.12 (and some packages have a point release, eg hledger is at 1.12.1). You can find all the latest hledger package releases at http://hackage.haskell.org/packages/search?terms=hledger . Some of these are possibilities for adding if you feel like it:
But not hledger-irr (superseded by hledger roi) or the others.
I noticed, and made the mistake of making a variable for the package version for all packages (ackording to the DRY principle); I'll have to think about how to best manage this. Perhaps use a variable for the major version of hledger, and then allow for point releases to separate packages as needed?
I'm also not sure what the culture is for homebrew regarding packaging large numbers of small utilities. I think it makes more sense to package everything (possibly even hledger-ui etc) as separate packages and allow the user to install them one by one. However, I think there is also a good case to be made for taking the "batteries included" approach and bundling the core utilities.
How was this done on other platforms?
That's how I do it in hledger-install.sh (which I see needs an update).
hledger is in multiple packages for reasons mainly to do with development, maintenance, packaging, and platform compatibility; if easy to install, as it is with homebrew, I think users would naturally want everything installed with as little effort as possible. So batteries included in one formula sounds good to me. What do you think @hpdeifel, @peti, and @gebner ?
http://hledger.org/download.html#a shows how it is on other platforms. Mostly separate packages, which makes sense if building from source (which is slow), but otherwise I think is just hassle for users.
I will say there are times when you can't build something (say hledger-web) for a while due to tooling or dependency issues, and then we'd have to either keep the whole formula on hold (no good) or update parts of it (eg release new hledger & hledger-ui while keeping the old hledger-web). Which I guess would be ok.
I think macOS users are on average less packaging minimalist and more hassle-averse than, say, many other Unix users, so it makes sense to me to bundle all the batteries into the Homebrew release, at least as many as hledger-install.sh packages, but I suggest we let the discussion sit for a while. There is no rush to update, I presume? Also, I am still waiting for the Homebrew CI jobs to test my pull request.
@albins I pinged https://github.com/Homebrew/homebrew-core/pull/35727 a few times and am waiting for any response to a (first) inquiry on #homebrew. We are stalled and I'm not sure how this process is supposed to work. Homebrew is going through some changes which might be disrupting things.
@simonmichael I saw, but thanks for notifying me! I guess something will happen, eventually.
In the meanwhile, I have now switched to hledger for all my bookkeeping (yay!), which means that I am dependent on the homebrew package for the foreseeable future. This means that I'd be fine with maintaining the Homebrew package as long as nothing spectacular happens, if you are looking for a package maintainer (whatever that might mean; I have never done anything in Homebrew before).
That would be great. I guess your first task is to find out how this process is supposed to work and why it isn't..
Later: Homebrew 2.0 is just out, with linux and windows support. Might be interesting to try those.
Yes! I don't have ready access to Windows 10, but I'll ask around and see if I know anyone who might be able to test it for me.
My guess would be that everything should work out of the box, given that nothing is platform-specific.
For future reference, in case we decide making an official "tap" and building our own binaries is less hassle: https://chrispenner.ca/posts/homebrew-haskell, http://octavore.com/posts/2016/02/15/distributing-go-apps-os-x
PR has finally been merged, and hledger-ui/web/api are in homebrew at long last. Thanks @albins!
$ brew reinstall hledger-ui
...
$ brew list hledger
/usr/local/Cellar/hledger/1.11.1/bin/hledger
/usr/local/Cellar/hledger/1.11.1/bin/hledger-api
/usr/local/Cellar/hledger/1.11.1/bin/hledger-ui
/usr/local/Cellar/hledger/1.11.1/bin/hledger-web
/usr/local/Cellar/hledger/1.11.1/share/doc/ (4 files)
Could you update it to the latest releases now ?
Yay! I'll have a look at it!
I have started working on this and have a formula working, but it's incredibly difficult to do even basic things with the Homebrew git repository for reasons I don't understand. Even doing basic things like creating a fork, updating it and making a pull request seems to be just...buggy; I don't see my commits when I push, and the commit history seems to get messed up such that I cannot push to my remote etc.
Ok, it's up: https://github.com/Homebrew/homebrew-core/pull/37050
Thanks! Easiest hledger upgrade ever.
$ brew upgrade hledger
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
hledger ✔ youtube-dl ✔ pypy weechat
==> Upgrading 1 outdated package:
hledger 1.11.1 -> 1.13.2
==> Upgrading hledger
==> Downloading https://homebrew.bintray.com/bottles/hledger-1.13.2.mojave.bottle.tar.gz
########################################################################################################################################################################## 100.0%
==> Pouring hledger-1.13.2.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/hledger/1.13.2: 13 files, 65MB
Removing: /usr/local/Cellar/hledger/1.11.1... (13 files, 66.6MB)
Removing: /Users/simon/Library/Caches/Homebrew/hledger--1.11.1.mojave.bottle.1.tar.gz... (15.2MB)
$ /usr/local/bin/hledger --version
hledger 1.13.2
$ /usr/local/bin/hledger-ui --version
hledger-ui 1.13.1
$ /usr/local/bin/hledger-web --version
hledger-web 1.13
$ /usr/local/bin/hledger-api --version
hledger-api 1.13
So, anybody tried homebrew on windows or GNU/linux yet ?
LinuxBrew info: https://linuxbrew.sh/
@albins could you update the homebrew package to latest release ?
Yes of course!
On 10 Mar 2019, 02:31 +1100, Simon Michael notifications@github.com, wrote:
@albins could you update the homebrew package to latest release ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Thanks @albins.
Hey I just heard about bump-formula-pr, do you know it ? :
it's literally one command and it does it all for you
does the bump, checkout, submits, opens a pr
i pass a link to the updated tarball.. for example, I did mutt like this:
brew bump-formula-pr --url=https://bitbucket.org/mutt/mutt/downloads/mutt-1.11.3.tar.gz
I learned Homebrew is the correct name on all platforms now; I've updated the download page.
I've been testing it on ubuntu; it currently dies with "Accessing a corrupted shared library". Also brew update; brew info hledger on linux is still showing hledger 1.13.2 for some reason. Perhaps we can get help from #machomebrew on Freenode or from https://github.com/Homebrew/linuxbrew-core/issues or https://discourse.brew.sh/c/linuxbrew.
For fun, here is the homebrew 30-day requested installs chart: https://formulae.brew.sh/analytics/install-on-request/30d (more stats)
@simonmichael Yay! It's nice to see that at least someone is using it!
I did know about bump-formula-pr, but I am not sure if it works when you are using bundled dependencies as we are in the formula.
Thanks @albins.
Hey I just heard about bump-formula-pr, do you know it ? :
it's literally one command and it does it all for you does the bump, checkout, submits, opens a pr i pass a link to the updated tarball.. for example, I did mutt like this: brew bump-formula-pr --url=https://bitbucket.org/mutt/mutt/downloads/mutt-1.11.3.tar.gzI learned Homebrew is the correct name on all platforms now; I've updated the download page.
I've been testing it on ubuntu; it currently dies with "Accessing a corrupted shared library". Also
brew update; brew info hledgeron linux is still showing hledger 1.13.2 for some reason. Perhaps we can get help from #machomebrew on Freenode or from https://github.com/Homebrew/linuxbrew-core/issues or https://discourse.brew.sh/c/linuxbrew.
I don't know what has happened, but I just tried installing it on latest Ubuntu in Vagrant, and I first got an obscure error from ld which turned out to be out-of-memory related. After increasing the allocated RAM to the VM, it installed and ran fine:
vagrant@ubuntu-cosmic:~$ hledger --version
hledger 1.14.2
Great, thanks for the testing. By the way, homebrew formula could use an update for the latest minor releases.
Great, thanks for the testing. By the way, homebrew formula could use an update for the latest minor releases.
already? I'll get on it
For the wishlist: the homebrew package should install the man pages (and info manuals if supported).
That’s a good idea; I’ll have a look at it
On 22 Mar 2019, 15:43 +0100, Simon Michael notifications@github.com, wrote:
For the wishlist: the homebrew package should install the man pages (and info manuals if supported).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
For the wishlist: the homebrew package should install the man pages (and info manuals if supported).
Ok, I have looked into it a bit; it appears that Homebrew expects man pages in $PREFIX/share/man/... rather than $PREFIX/man/. I figured it was probably faster to ask you, @simonmichael; do you know a) where where the man pages are currently being installed and b) which options to pass to change that?
I’m assuming they’re not being installed right now. You’ll see them in the tarballs on hackage I think.
On Mar 23, 2019, at 12:55, Albin Stjerna notifications@github.com wrote:
For the wishlist: the homebrew package should install the man pages (and info manuals if supported).
Ok, I have looked into it a bit; it appears that Homebrew expects man pages in $PREFIX/share/man/... rather than $PREFIX/man/. I figured it was probably faster to ask you, @simonmichael; do you know a) where where the man pages are currently being installed and b) which options to pass to change that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Some software installed by homebrew has a --HEAD option. A motivating example is, hledger 1.16.* does not have the new ISO date features. I wonder if it's easier to add --HEAD option, or update homebrew's hledger.
hledger 1.17 has landed in homebrew at last. It includes the man pages and info manuals this time; thanks for pinging this issue.
Currently in the Homebrew 1 year requested installs chart hledger is #1521 of 10000 on mac and #770 of 8288 on linux.
Most helpful comment
What about formulas for hledger-ui & hledger-web?