Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install older version of Pandoc (<2) using homebrew

I just re-installed my macOS. Using brew install pandoc I installed Pandoc, and it installed v2, which caused some of my regression tests of a web app to fail.

As I'm running an older version on my server (1.16.0.2), I want to install this version on my computer.

But sadly, I don't seem to be able to do it with homebrew, as there doesn't seem to be a legacy version available, only the most current one? The brew search command doesn't show any versions:

$ brew search pandoc
==> Searching local taps...
pandoc ✔                                                pandoc-citeproc                                         pandoc-crossref
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...

I tried stuff like brew install [email protected] but didn't work out.

like image 753
Joshua Muheim Avatar asked Jan 24 '18 19:01

Joshua Muheim


1 Answers

Option 1) Use old formulas

You can use the git history to obtain the formula for pandoc 1.16.0.2.

Go to the local directory where formulas are stored:

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

Look at the history of pandoc

git log pandoc.rb

It appears that the last commit of version 1.16.0.2 is commit 53d113c339280e6bc43325afd24333.

1) To be sure to obtain all dependencies at the right version you have to checkout all formulas at this commit, (you can also checkout only the dependency graph).

git checkout 53d113c339

2) The formula cabal-install use an old homebrew construct remove it with:

brew edit cabal-install

and by removing the bottle section.

3) By default, homebrew make an update before an install, so you have to specify to not update before the install:

HOMEBREW_NO_AUTO_UPDATE=1 brew install pandoc

It will take a long time because you have to compile everything, there is no bottles for the last versions of macOS (Sierra and High Sierra). Depending on your version of macOS you could face some compilation problems...

Option 2) Use old bottles

There is available bottles for OS X Mavericks (10.9), OS X Yosemite (10.10) and OS X El Capitan (10.11). You can install them manually but you will also need to install the dependencies (cabal-install 1.22.6.0 and ghc 7.10.3) with the right versions. For installing an old bottle checkout the old formula, copy the old bottle to ~/Library/Caches/Homebrew/ and install it with:

HOMEBREW_NO_AUTO_UPDATE=1 brew install bottle_name

Option 3) Build your own retro-formula

Another option is to rewrite the current pandoc formula for your desired version.

Conclusion

Each of these options is a possible way, but none of them is easy. There is no easy way to install an older version of Pandoc with Homebrew. You should probaly use an Haskell version manager such as Stack.

like image 75
Ortomala Lokni Avatar answered Oct 31 '22 20:10

Ortomala Lokni