git.iko.soy/typeable/pandoc
on 34412cf help sign in
typeable/pandoc/INSTALL.md
354 lines 13 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 - If you'd prefer, you can extract the pandoc and pandoc-citeproc
11 executables from the MSI and copy them directly to any directory,
12 without running the installer. Here is an example showing how to
13 extract the executables from the pandoc-1.19.1 installer and copy
14 them to `C:\Utils\Console\`:
16 mkdir "%TEMP%\pandoc\"
17 start /wait msiexec.exe /a pandoc-1.19.1-windows.msi /qn targetdir="%TEMP%\pandoc\"
18 copy /y "%TEMP%\pandoc\pandoc.exe" C:\Utils\Console\
19 copy /y "%TEMP%\pandoc\pandoc-citeproc.exe" C:\Utils\Console\
20 rmdir /s /q "%TEMP%\pandoc\"
22## MacOS
24 - There is a package installer at pandoc's [download page].
25 If you later want to uninstall the package, you can do so
26 by downloading [this script][uninstaller]
27 and running it with `perl uninstall-pandoc.pl`.
29 - It is possible to extract the pandoc and pandoc-citeproc
30 executables from the MacOS pkg file, if you'd rather not run
31 the installer. To do this (for the version 1.19.1 package):
33 mkdir pandoc-extract
34 cd pandoc-extract
35 xar -x ../pandoc-1.19.1-osx.pkg
36 cat pandoc.pkg/Payload | gunzip -dc | cpio -i
37 # executables are now in ./usr/bin/, man pages in ./usr/share/man
39 - You can also install pandoc using
40 [homebrew](http://brew.sh): `brew install pandoc`.
42 - For PDF output, you'll also need LaTeX. Because a full [MacTeX]
43 installation takes more than a gigabyte of disk space, we recommend
44 installing [BasicTeX](http://www.tug.org/mactex/morepackages.html)
45 (64M) and using the `tlmgr` tool to install additional packages
46 as needed. If you get errors warning of fonts not found, try
48 tlmgr install collection-fontsrecommended
50## Linux
52 - First, try your package manager.
53 Pandoc is in the [Debian], [Ubuntu], [Slackware],
54 [Arch], [Fedora], [NiXOS], [openSUSE], and [gentoo] repositories.
55 Note, however, that versions in the repositories are often
56 old.
58 - For 64-bit [Debian] and [Ubuntu], we provide a debian package
59 on the [download page].
61 sudo dpkg -i $DEB
63 where `$DEB` is the path to the downloaded deb, will
64 install the `pandoc` and `pandoc-citeproc` executables
65 and man pages.
67 - If you use an RPM-based distro, you may be
68 able to install this deb using `alien`, or try
70 ar p $DEB data.tar.gz | sudo tar xvz --strip-components 2 -C /usr/local
72 - If you'd rather install pandoc in your home directory, say
73 in `$HOME/.local`, then you can extract the files manually
74 from the deb:
76 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $HOME/.local/
78 where, again, `$DEB` is the path to the downloaded deb.
80 - If the version in your repository is too old and you cannot
81 use the deb we provide, you can install from source, using the
82 instructions below under [Compiling from source].
83 Note that most distros have the Haskell platform in their
84 package repositories. For example, on Debian/Ubuntu,
85 you can install it with `apt-get install haskell-platform`.
87 - For PDF output, you'll need LaTeX. We recommend installing
88 [TeX Live](http://www.tug.org/texlive/) via your package
89 manager. (On Debian/Ubuntu, `apt-get install texlive`.)
91## BSD
93 - Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
95## Compiling from source
97If for some reason a binary package is not available for your
98platform, or if you want to hack on pandoc or use a non-released
99version, you can install from source.
101### Getting the pandoc source code
103Source tarballs can be found at
104<https://hackage.haskell.org/package/pandoc>. For example, to
105fetch the source for version 1.17.0.3:
107 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
108 tar xvzf pandoc-1.17.0.3.tar.gz
109 cd pandoc-1.17.0.3
111Or you can fetch the development code by cloning the repository:
113 git clone https://github.com/jgm/pandoc
114 cd pandoc
116Note: there may be times when the development code is broken
117or depends on other libraries which must be installed
118separately. Unless you really know what you're doing, install
119the last released version.
121### Quick stack method
123The easiest way to build pandoc from source is to use [stack]:
1251. Install [stack].
1272. Change to the pandoc source directory and issue the following commands:
129 stack setup
130 stack install --test
132 `stack setup` will automatically download the ghc compiler
133 if you don't have it. `stack install` will install the
134 `pandoc` executable into `~/.local/bin`, which you should
135 add to your `PATH`. This process will take a while, and
136 will consume a considerable amount of disk space.
138### Quick cabal method
1401. Install the [Haskell platform]. This will give you [GHC] and
141 the [cabal-install] build tool. Note that pandoc requires
142 GHC >= 7.8.
1442. Update your package database:
146 cabal update
1483. Use `cabal` to install pandoc and its dependencies:
150 cabal install pandoc --enable-tests
152 This procedure will install the released version of pandoc,
153 which will be downloaded automatically from HackageDB.
155 If you want to install a modified or development version
156 of pandoc instead, switch to the source directory and do
157 as above, but without the 'pandoc':
159 cabal install
1614. Make sure the `$CABALDIR/bin` directory is in your path. You should
162 now be able to run `pandoc`:
164 pandoc --help
166 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
1685. If you want to process citations with pandoc, you will also need to
169 install a separate package, `pandoc-citeproc`. This can be installed
170 using cabal:
172 cabal install pandoc-citeproc
174 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
175 to sort bibliography entries (RFC 5051). If you would like to
176 use the locale-sensitive unicode collation algorithm instead,
177 specify the `unicode_collation` flag:
179 cabal install pandoc-citeproc -funicode_collation
181 Note that this requires the `text-icu` library, which in turn
182 depends on the C library `icu4c`. Installation directions
183 vary by platform. Here is how it might work on MacOS with homebrew:
185 brew install icu4c
186 cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \
187 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
188 -funicode_collation text-icu pandoc-citeproc
1906. The `pandoc.1` man page will be installed automatically. cabal shows
191 you where it is installed: you may need to set your `MANPATH`
192 accordingly. If `MANUAL.txt` has been modified, the man page can be
193 rebuilt: `make man/pandoc.1`.
195 The `pandoc-citeproc.1` man page will also be installed automatically.
198### Custom cabal method
200This is a step-by-step procedure that offers maximal control
201over the build and installation. Most users should use the
202quick install, but this information may be of use to packagers.
203For more details, see the [Cabal User's Guide]. These instructions
204assume that the pandoc source directory is your working directory.
2061. Install dependencies: in addition to the [Haskell platform],
207 you will need a number of additional libraries. You can install
208 them all with
210 cabal update
211 cabal install --only-dependencies
2132. Configure:
215 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
216 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
217 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
218 --mandir=DIR --flags=FLAGSPEC --enable-tests
220 All of the options have sensible defaults that can be overridden
221 as needed.
223 `FLAGSPEC` is a list of Cabal configuration flags, optionally
224 preceded by a `-` (to force the flag to `false`), and separated
225 by spaces. Pandoc's flags include:
227 - `embed_data_files`: embed all data files into the binary (default no).
228 This is helpful if you want to create a relocatable binary.
229 Note: if this option is selected, you need to install the
230 `hsb2hs` preprocessor: `cabal install hsb2hs` (version 0.3.1 or
231 higher is required).
233 - `https`: enable support for downloading resources over https
234 (using the `http-client` and `http-client-tls` libraries).
2363. Build:
238 cabal build
239 cabal test
2414. Build API documentation:
243 cabal haddock --html-location=URL --hyperlink-source
2455. Copy the files:
247 cabal copy --destdir=PATH
249 The default destdir is `/`.
2516. Register pandoc as a GHC package:
253 cabal register
255 Package managers may want to use the `--gen-script` option to
256 generate a script that can be run to register the package at
257 install time.
259### Creating a relocatable binary
261It is possible to compile pandoc such that the data files
262pandoc uses are embedded in the binary. The resulting binary
263can be run from any directory and is completely self-contained.
264With cabal, add `-fembed_data_files` to the `cabal configure`
265or `cabal install` commands.
267With stack, use `--flag pandoc:embed_data_files`.
271### Running tests
273Pandoc comes with an automated test suite.
274To run with cabal, `cabal test`; to run with stack, `stack
275test`.
277To run particular tests (pattern-matching on their names), use
278the `-t` option:
280 cabal test --test-options='-t markdown'
282If you add a new feature to pandoc, please add tests as well, following
283the pattern of the existing tests. The test suite code is in
284`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
285probably easiest to add some data files to the `test` directory, and
286modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
287under the `test/Tests` hierarchy corresponding to the pandoc module you
288are changing.
290### Running benchmarks
292To build and run the benchmarks:
294 cabal configure --enable-benchmarks && cabal build
295 cabal bench
297or with stack:
299 stack bench
301To use a smaller sample size so the benchmarks run faster:
303 cabal bench --benchmark-options='-s 20'
305To run just the markdown benchmarks:
307 cabal bench --benchmark-options='markdown'
309### Building the whole pandoc ecosystem
311Sometimes pandoc's development code depends on unreleased versions
312of dependent libraries. You'll need to build these as well. A
313maximal build method would be
315 mkdir pandoc-build
316 cd pandoc-build
317 git clone https://github.com/jgm/pandoc-types
318 git clone https://github.com/jgm/texmath
319 git clone https://github.com/jgm/pandoc-citeproc
320 git clone https://github.com/jgm/pandoc
321 git clone https://github.com/jgm/cmark-hs
322 git clone https://github.com/jgm/zip-archive
323 cd pandoc
324 stack install --test --install-ghc --stack-yaml stack.full.yaml
326To pull in the latest changes, after you've done this and there have been
327changes in the repositories: Visit each repository in pandoc-build
328(pandoc-types, texmath, pandoc-citeproc, pandoc, zip-archive, cmark-hs) and do
329`git pull`. In the pandoc repo, also do `stack install --test
330--stack-yaml stack.full.yaml`.
333[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
334[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
335[Debian]: http://packages.debian.org/lenny/pandoc
336[Fedora]: https://apps.fedoraproject.org/packages/pandoc
337[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/
338[GHC]: http://www.haskell.org/ghc/
339[GPL]: http://www.gnu.org/copyleft/gpl.html
340[Haskell platform]: http://hackage.haskell.org/platform/
341[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
342[MacTeX]: https://tug.org/mactex/
343[NetBSD]: http://pkgsrc.se/wip/pandoc
344[NixOS]: http://nixos.org/nixos/
345[Slackware]: http://www.linuxpackages.net/search_view.php?by=name&name=pandoc&ver=
346[Ubuntu]: http://www.ubuntu.com
347[download page]: https://github.com/jgm/pandoc/releases/latest
348[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
349[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
350[openSUSE]: https://software.opensuse.org/package/pandoc
351[source tarball]: http://hackage.haskell.org/package/pandoc
352[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html
353[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
354[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl