git.iko.soy/typeable/pandoc
on free help sign in
typeable/pandoc/INSTALL.md
339 lines 12 kB history raw
1# Installing pandoc
3## Windows
5 - There is a package installer at pandoc's [download page].
7 - For PDF output, you'll also need to install LaTeX.
8 We recommend [MiKTeX](http://miktex.org/).
10## Mac OS X
12 - There is a package installer at pandoc's [download page].
13 If you later want to uninstall the package, you can do so
14 by downloading [this script][uninstaller]
15 and running it with `perl uninstall-pandoc.pl`.
17 - You can also install pandoc using
18 [homebrew](http://brew.sh): `brew install pandoc`.
20 - For PDF output, you'll also need LaTeX. Because a full [MacTeX]
21 installation takes more than a gigabyte of disk space, we recommend
22 installing [BasicTeX](http://www.tug.org/mactex/morepackages.html)
23 (64M) and using the `tlmgr` tool to install additional packages
24 as needed. If you get errors warning of fonts not found, try
26 tlmgr install collection-fontsrecommended
28## Linux
30 - First, try your package manager.
31 Pandoc is in the [Debian], [Ubuntu], [Slackware],
32 [Arch], [Fedora], [NiXOS], [openSUSE], and [gentoo] repositories.
33 Note, however, that versions in the repositories are often
34 old.
36 - For 64-bit [Debian] and [Ubuntu], we provide a debian package
37 on the [download page].
39 sudo dpkg -i $DEB
41 where `$DEB` is the path to the downloaded deb, will
42 will install the `pandoc` and `pandoc-citeproc` executables
43 and man pages. If you use an RPM-based distro, you may be
44 able to install this deb using `alien`, or try
46 ar p $DEB data.tar.gz | sudo tar xvz --strip-components 2 -C /usr/local
48 - If you'd rather install pandoc in your home directory, say
49 in `$HOME/.local`, then you can extract the files manually
50 from the deb:
52 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $HOME/.local/
54 where, again, `$DEB` is the path to the downloaded deb.
56 - If the version in your repository is too old and you cannot
57 use the deb we provide, you can install from source, using the
58 instructions below under [Installing from source].
59 Note that most distros have the Haskell platform in their
60 package repositories. For example, on Debian/Ubuntu,
61 you can install it with `apt-get install haskell-platform`.
63 - For PDF output, you'll need LaTeX. We recommend installing
64 [TeX Live](http://www.tug.org/texlive/) via your package
65 manager. (On Debian/Ubuntu, `apt-get install texlive`.)
67## BSD
69 - Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
71## Compiling from source
73If for some reason a binary package is not available for your
74platform, or if you want to hack on pandoc or use a non-released
75version, you can install from source.
77### Getting the pandoc source code
79Source tarballs can be found at
80<https://hackage.haskell.org/package/pandoc>. For example, to
81fetch the source for version 1.17.0.3:
83 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
84 tar xvzf pandoc-1.17.0.3.tar.gz
85 cd pandoc-1.17.0.3
87Or you can fetch the development code by cloning the repository:
89 git clone https://github.com/jgm/pandoc
90 cd pandoc
91 git submodule update --init # to fetch the templates
93Note: there may be times when the development code is broken
94or depends on other libraries which must be installed
95separately. Unless you really know what you're doing, install
96the last released version.
98### Quick stack method
100The easiest way to build pandoc from source is to use [stack]:
1021. Install [stack].
1042. Change to the pandoc source directory and issue the following commands:
106 stack setup
107 stack install --test
109 `stack setup` will automatically download the ghc compiler
110 if you don't have it. `stack install` will install the
111 `pandoc` executable into `~/.local/bin`, which you should
112 add to your `PATH`. This process will take a while, and
113 will consume a considerable amount of disk space.
115### Quick cabal method
1171. Install the [Haskell platform]. This will give you [GHC] and
118 the [cabal-install] build tool. Note that pandoc requires
119 GHC >= 7.8.
1212. Update your package database:
123 cabal update
1253. Use `cabal` to install pandoc and its dependencies:
127 cabal install pandoc --enable-tests
129 This procedure will install the released version of pandoc,
130 which will be downloaded automatically from HackageDB.
132 If you want to install a modified or development version
133 of pandoc instead, switch to the source directory and do
134 as above, but without the 'pandoc':
136 cabal install
138 Note: If you obtained the source from the git repository (rather
139 than a release tarball), you'll need to do
141 git submodule update --init
143 to fetch the contents of `data/templates` before `cabal install`.
1454. Make sure the `$CABALDIR/bin` directory is in your path. You should
146 now be able to run `pandoc`:
148 pandoc --help
150 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
1525. If you want to process citations with pandoc, you will also need to
153 install a separate package, `pandoc-citeproc`. This can be installed
154 using cabal:
156 cabal install pandoc-citeproc
158 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
159 to sort bibliography entries (RFC 5051). If you would like to
160 use the locale-sensitive unicode collation algorithm instead,
161 specify the `unicode_collation` flag:
163 cabal install pandoc-citeproc -funicode_collation
165 Note that this requires the `text-icu` library, which in turn
166 depends on the C library `icu4c`. Installation directions
167 vary by platform. Here is how it might work on OSX with homebrew:
169 brew install icu4c
170 cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \
171 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
172 -funicode_collation text-icu pandoc-citeproc
1746. The `pandoc.1` man page will be installed automatically. cabal shows
175 you where it is installed: you may need to set your `MANPATH`
176 accordingly. If `MANUAL.txt` has been modified, the man page can be
177 rebuilt: `make man/pandoc.1`.
179 The `pandoc-citeproc.1` man page will also be installed automatically.
182### Custom cabal method
184This is a step-by-step procedure that offers maximal control
185over the build and installation. Most users should use the
186quick install, but this information may be of use to packagers.
187For more details, see the [Cabal User's Guide]. These instructions
188assume that the pandoc source directory is your working directory.
1901. Install dependencies: in addition to the [Haskell platform],
191 you will need a number of additional libraries. You can install
192 them all with
194 cabal update
195 cabal install --only-dependencies
1972. Configure:
199 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
200 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
201 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
202 --mandir=DIR --flags=FLAGSPEC --enable-tests
204 All of the options have sensible defaults that can be overridden
205 as needed.
207 `FLAGSPEC` is a list of Cabal configuration flags, optionally
208 preceded by a `-` (to force the flag to `false`), and separated
209 by spaces. Pandoc's flags include:
211 - `embed_data_files`: embed all data files into the binary (default no).
212 This is helpful if you want to create a relocatable binary.
213 Note: if this option is selected, you need to install the
214 `hsb2hs` preprocessor: `cabal install hsb2hs` (version 0.3.1 or
215 higher is required).
217 - `https`: enable support for downloading resources over https
218 (using the `http-client` and `http-client-tls` libraries).
2203. Build:
222 cabal build
223 cabal test
2254. Build API documentation:
227 cabal haddock --html-location=URL --hyperlink-source
2295. Copy the files:
231 cabal copy --destdir=PATH
233 The default destdir is `/`.
2356. Register pandoc as a GHC package:
237 cabal register
239 Package managers may want to use the `--gen-script` option to
240 generate a script that can be run to register the package at
241 install time.
243### Creating a relocatable binary
245It is possible to compile pandoc such that the data files
246pandoc uses are embedded in the binary. The resulting binary
247can be run from any directory and is completely self-contained.
248With cabal, add `-fembed_data_files` to the `cabal configure`
249or `cabal install` commands.
251With stack, use `--flag pandoc:embed_data_files`.
255### Running tests
257Pandoc comes with an automated test suite.
258To run with cabal, `cabal test`; to run with stack, `stack
259test`.
261To run particular tests (pattern-matching on their names), use
262the `-t` option:
264 cabal test --test-options='-t markdown'
266If you add a new feature to pandoc, please add tests as well, following
267the pattern of the existing tests. The test suite code is in
268`tests/test-pandoc.hs`. If you are adding a new reader or writer, it is
269probably easiest to add some data files to the `tests` directory, and
270modify `tests/Tests/Old.hs`. Otherwise, it is better to modify the module
271under the `tests/Tests` hierarchy corresponding to the pandoc module you
272are changing.
274### Running benchmarks
276To build and run the benchmarks:
278 cabal configure --enable-benchmarks && cabal build
279 cabal bench
281or with stack:
283 stack bench
285To use a smaller sample size so the benchmarks run faster:
287 cabal bench --benchmark-options='-s 20'
289To run just the markdown benchmarks:
291 cabal bench --benchmark-options='markdown'
293### Building the whole pandoc ecosystem
295Sometimes pandoc's development code depends on unreleased versions
296of dependent libraries. You'll need to build these as well. A
297maximal build method would be
299 mkdir pandoc-build
300 cd pandoc-build
301 git clone https://github.com/jgm/pandoc-types
302 git clone https://github.com/jgm/texmath
303 git clone https://github.com/jgm/pandoc-citeproc
304 git clone https://github.com/jgm/pandoc
305 git clone https://github.com/jgm/cmark-hs
306 git clone https://github.com/jgm/zip-archive
307 cd pandoc
308 git submodule update --init
309 stack install --test --install-ghc --stack-yaml stack.full.yaml
311To pull in the latest changes, after you've done this and there have been
312changes in the repositories: Visit each repository in pandoc-build
313(pandoc-types, texmath, pandoc-citeproc, pandoc, zip-archive, cmark-hs) and do
314`git pull`. In the pandoc repo, also do `git submodule update` and `stack
315install --test --stack-yaml stack.full.yaml`.
318[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
319[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
320[Debian]: http://packages.debian.org/lenny/pandoc
321[Fedora]: https://apps.fedoraproject.org/packages/pandoc
322[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/
323[GHC]: http://www.haskell.org/ghc/
324[GPL]: http://www.gnu.org/copyleft/gpl.html
325[Haskell platform]: http://hackage.haskell.org/platform/
326[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
327[MacTeX]: https://tug.org/mactex/
328[NetBSD]: http://pkgsrc.se/wip/pandoc
329[NixOS]: http://nixos.org/nixos/
330[Slackware]: http://www.linuxpackages.net/search_view.php?by=name&name=pandoc&ver=
331[Ubuntu]: http://www.ubuntu.com
332[download page]: https://github.com/jgm/pandoc/releases/latest
333[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
334[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
335[openSUSE]: https://software.opensuse.org/package/pandoc
336[source tarball]: http://hackage.haskell.org/package/pandoc
337[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html
338[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
339[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/osx/uninstall-pandoc.pl