git.iko.soy/typeable/pandoc
on 2.4 help sign in
typeable/pandoc/INSTALL.md
364 lines 13 kB history raw
1# Installing pandoc
3## Windows
5 - There is a package installer at pandoc's [download page].
6 This will install pandoc, replacing older versions, and
7 update your path to include the directory where pandoc's
8 binaries are installed.
10 - If you prefer not to use the msi installer, we also provide
11 a zip file that contains pandoc's binaries and
12 documentation. Simply unzip this file and move the binaries
13 to a directory of your choice.
15 - Alternatively, you can install pandoc using
16 [chocolatey](https://chocolatey.org): `choco install pandoc`.
18 - For PDF output, you'll also need to install LaTeX.
19 We recommend [MiKTeX](http://miktex.org/).
21## macOS
23 - There is a package installer at pandoc's [download page].
24 If you later want to uninstall the package, you can do so
25 by downloading [this script][uninstaller]
26 and running it with `perl uninstall-pandoc.pl`.
28 - We also provide a zip file containing the binaries and man
29 pages, for those who prefer not to use the installer. Simply
30 unzip the file and move the binaries and man pages to
31 whatever directory you like.
33 - Alternatively, you can install pandoc using
34 [homebrew](http://brew.sh): `brew install pandoc`.
35 Note: If you are using macOS < 10.10, this method installs
36 pandoc from source, so it will take a long time and a lot of
37 disk space for the ghc compiler and dependent Haskell libraries.
39 - For PDF output, you'll also need LaTeX. Because a full [MacTeX]
40 installation takes more than a gigabyte of disk space, we recommend
41 installing [BasicTeX](http://www.tug.org/mactex/morepackages.html)
42 (64M) or [TinyTeX](https://yihui.name/tinytex/)
43 and using the `tlmgr` tool to install additional packages
44 as needed. If you get errors warning of fonts not found, try
46 tlmgr install collection-fontsrecommended
48## Linux
50 - First, try your package manager.
51 Pandoc is in the [Debian], [Ubuntu], [Slackware],
52 [Arch], [Fedora], [NiXOS], [openSUSE], and [gentoo] repositories.
53 Note, however, that versions in the repositories are often
54 old.
56 - We provide a binary package for amd64 architecture on
57 the [download page]. This provides both `pandoc` and
58 `pandoc-citeproc`. The executables are statically linked and
59 have no dynamic dependencies or dependencies on external
60 data files. Note: because of the static
61 linking, the pandoc binary from this package cannot use lua
62 filters that require external lua modules written in C.
64 Both a tarball and a deb installer are provided. To install the deb:
66 sudo dpkg -i $DEB
68 where `$DEB` is the path to the downloaded deb. This will
69 install the `pandoc` and `pandoc-citeproc` executables and
70 man pages.
72 If you use an RPM-based distro, you may be able to install
73 the deb from our download page using `alien`.
75 On any distro, you may install from the tarball into `$DEST`
76 (say, `/usr/local/` or `$HOME/.local`) by doing
78 tar xvzf $TGZ --strip-components 1 -C $DEST
80 where `$TGZ` is the path to the downloaded zipped tarball.
81 For Pandoc versions before 2.0, which don't provide
82 a tarball, try instead
84 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $DEST
86 - You can also install from source, using the
87 instructions below under [Compiling from source].
88 Note that most distros have the Haskell platform in their
89 package repositories. For example, on Debian/Ubuntu,
90 you can install it with `apt-get install haskell-platform`.
92 - For PDF output, you'll need LaTeX. We recommend installing
93 [TeX Live](http://www.tug.org/texlive/) via your package
94 manager. (On Debian/Ubuntu, `apt-get install texlive`.)
96## Chrome OS
98On Chrome OS, pandoc can be installed using the
99[chromebrew](https://github.com/skycocker/chromebrew) package manager
100with the command:
102```sh
103crew install pandoc
104```
106This will automatically build and configure pandoc for the specific
107device you are using.
109## BSD
111 - Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
113## Compiling from source
115If for some reason a binary package is not available for your
116platform, or if you want to hack on pandoc or use a non-released
117version, you can install from source.
119### Getting the pandoc source code
121Source tarballs can be found at
122<https://hackage.haskell.org/package/pandoc>. For example, to
123fetch the source for version 1.17.0.3:
125 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
126 tar xvzf pandoc-1.17.0.3.tar.gz
127 cd pandoc-1.17.0.3
129Or you can fetch the development code by cloning the repository:
131 git clone https://github.com/jgm/pandoc
132 cd pandoc
134Note: there may be times when the development code is broken
135or depends on other libraries which must be installed
136separately. Unless you really know what you're doing, install
137the last released version.
139### Quick stack method
141The easiest way to build pandoc from source is to use [stack]:
1431. Install [stack]. Note that Pandoc requires stack >= 1.6.0.
1452. Change to the pandoc source directory and issue the following commands:
147 stack setup
148 stack install
150 `stack setup` will automatically download the ghc compiler
151 if you don't have it. `stack install` will install the
152 `pandoc` executable into `~/.local/bin`, which you should
153 add to your `PATH`. This process will take a while, and
154 will consume a considerable amount of disk space.
156### Quick cabal method
1581. Install the [Haskell platform]. This will give you [GHC] and
159 the [cabal-install] build tool. Note that pandoc requires
160 GHC >= 7.10 and cabal >= 2.0.
1622. Update your package database:
164 cabal update
1663. Check your cabal version with
168 cabal --version
170 If you have a version less than 2.0, install the latest with:
172 cabal install cabal-install
1744. Use `cabal` to install pandoc and its dependencies:
176 cabal install pandoc
178 This procedure will install the released version of pandoc,
179 which will be downloaded automatically from HackageDB.
181 If you want to install a modified or development version
182 of pandoc instead, switch to the source directory and do
183 as above, but without the 'pandoc':
185 cabal install
1875. Make sure the `$CABALDIR/bin` directory is in your path. You should
188 now be able to run `pandoc`:
190 pandoc --help
192 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
1945. If you want to process citations with pandoc, you will also need to
195 install a separate package, `pandoc-citeproc`. This can be installed
196 using cabal:
198 cabal install pandoc-citeproc
200 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
201 to sort bibliography entries (RFC 5051). If you would like to
202 use the locale-sensitive unicode collation algorithm instead,
203 specify the `unicode_collation` flag:
205 cabal install pandoc-citeproc -funicode_collation
207 Note that this requires the `text-icu` library, which in turn
208 depends on the C library `icu4c`. Installation directions
209 vary by platform. Here is how it might work on macOS with homebrew:
211 brew install icu4c
212 cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \
213 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
214 -funicode_collation text-icu pandoc-citeproc
2166. The `pandoc.1` man page will be installed automatically. cabal shows
217 you where it is installed: you may need to set your `MANPATH`
218 accordingly. If `MANUAL.txt` has been modified, the man page can be
219 rebuilt: `make man/pandoc.1`.
221 The `pandoc-citeproc.1` man page will also be installed automatically.
224### Custom cabal method
226This is a step-by-step procedure that offers maximal control
227over the build and installation. Most users should use the
228quick install, but this information may be of use to packagers.
229For more details, see the [Cabal User's Guide]. These instructions
230assume that the pandoc source directory is your working directory.
231You will need cabal version 2.0 or higher.
2331. Install dependencies: in addition to the [Haskell platform],
234 you will need a number of additional libraries. You can install
235 them all with
237 cabal update
238 cabal install --only-dependencies
2402. Configure:
242 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
243 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
244 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
245 --mandir=DIR --flags=FLAGSPEC --enable-tests
247 All of the options have sensible defaults that can be overridden
248 as needed.
250 `FLAGSPEC` is a list of Cabal configuration flags, optionally
251 preceded by a `-` (to force the flag to `false`), and separated
252 by spaces. Pandoc's flags include:
254 - `embed_data_files`: embed all data files into the binary (default no).
255 This is helpful if you want to create a relocatable binary.
257 - `https`: enable support for downloading resources over https
258 (using the `http-client` and `http-client-tls` libraries).
2603. Build:
262 cabal build
263 cabal test
2654. Build API documentation:
267 cabal haddock --html-location=URL --hyperlink-source
2695. Copy the files:
271 cabal copy --destdir=PATH
273 The default destdir is `/`.
2756. Register pandoc as a GHC package:
277 cabal register
279 Package managers may want to use the `--gen-script` option to
280 generate a script that can be run to register the package at
281 install time.
283### Creating a relocatable binary
285It is possible to compile pandoc such that the data files
286pandoc uses are embedded in the binary. The resulting binary
287can be run from any directory and is completely self-contained.
288With cabal, add `-fembed_data_files` to the `cabal configure`
289or `cabal install` commands.
291With stack, use `--flag pandoc:embed_data_files`.
295### Running tests
297Pandoc comes with an automated test suite.
298To run with cabal, `cabal test`; to run with stack, `stack
299test`.
301To run particular tests (pattern-matching on their names), use
302the `-p` option:
304 cabal install pandoc --enable-tests
305 cabal test --test-options='-p markdown'
307Or with stack:
309 stack test --test-arguments='-p markdown'
311It is often helpful to add `-j4` (run tests in parallel)
312and `--hide-successes` (don't clutter output with successes)
313to the test arguments as well.
315If you add a new feature to pandoc, please add tests as well, following
316the pattern of the existing tests. The test suite code is in
317`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
318probably easiest to add some data files to the `test` directory, and
319modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
320under the `test/Tests` hierarchy corresponding to the pandoc module you
321are changing.
323### Running benchmarks
325To build and run the benchmarks:
327 cabal configure --enable-benchmarks && cabal build
328 cabal bench
330or with stack:
332 stack bench
334To use a smaller sample size so the benchmarks run faster:
336 cabal bench --benchmark-options='-s 20'
338To run just the markdown benchmarks:
340 cabal bench --benchmark-options='markdown'
343[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
344[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
345[Debian]: https://packages.debian.org/pandoc
346[Fedora]: https://apps.fedoraproject.org/packages/pandoc
347[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/
348[GHC]: http://www.haskell.org/ghc/
349[GPL]: http://www.gnu.org/copyleft/gpl.html
350[Haskell platform]: http://hackage.haskell.org/platform/
351[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
352[MacTeX]: https://tug.org/mactex/
353[NetBSD]: http://pkgsrc.se/wip/pandoc
354[NixOS]: https://nixos.org/nixos/packages.html
355[Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=
356[Ubuntu]: https://packages.ubuntu.com/pandoc
357[download page]: https://github.com/jgm/pandoc/releases/latest
358[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
359[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
360[openSUSE]: https://software.opensuse.org/package/pandoc
361[source tarball]: http://hackage.haskell.org/package/pandoc
362[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html
363[cabal-install]: http://hackage.haskell.org/package/cabal-install
364[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl