git.iko.soy/typeable/pandoc
on commonmark-github help sign in
typeable/pandoc/INSTALL.md
359 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.
230 - `https`: enable support for downloading resources over https
231 (using the `http-client` and `http-client-tls` libraries).
2333. Build:
235 cabal build
236 cabal test
2384. Build API documentation:
240 cabal haddock --html-location=URL --hyperlink-source
2425. Copy the files:
244 cabal copy --destdir=PATH
246 The default destdir is `/`.
2486. Register pandoc as a GHC package:
250 cabal register
252 Package managers may want to use the `--gen-script` option to
253 generate a script that can be run to register the package at
254 install time.
256### Creating a relocatable binary
258It is possible to compile pandoc such that the data files
259pandoc uses are embedded in the binary. The resulting binary
260can be run from any directory and is completely self-contained.
261With cabal, add `-fembed_data_files` to the `cabal configure`
262or `cabal install` commands.
264With stack, use `--flag pandoc:embed_data_files`.
268### Running tests
270Pandoc comes with an automated test suite.
271To run with cabal, `cabal test`; to run with stack, `stack
272test`.
274To run particular tests (pattern-matching on their names), use
275the `-p` option:
277 cabal test --test-options='-p markdown'
279Or with stack:
281 stack test --test-arguments='-p markdown'
283It is often helpful to add `-j4` (run tests in parallel)
284and `--hide-successes` (don't clutter output with successes)
285to the test arguments as well.
287If you add a new feature to pandoc, please add tests as well, following
288the pattern of the existing tests. The test suite code is in
289`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
290probably easiest to add some data files to the `test` directory, and
291modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
292under the `test/Tests` hierarchy corresponding to the pandoc module you
293are changing.
295### Running benchmarks
297To build and run the benchmarks:
299 cabal configure --enable-benchmarks && cabal build
300 cabal bench
302or with stack:
304 stack bench
306To use a smaller sample size so the benchmarks run faster:
308 cabal bench --benchmark-options='-s 20'
310To run just the markdown benchmarks:
312 cabal bench --benchmark-options='markdown'
314### Building the whole pandoc ecosystem
316Sometimes pandoc's development code depends on unreleased versions
317of dependent libraries. You'll need to build these as well. A
318maximal build method would be
320 mkdir pandoc-build
321 cd pandoc-build
322 git clone https://github.com/jgm/pandoc-types
323 git clone https://github.com/jgm/texmath
324 git clone https://github.com/jgm/pandoc-citeproc
325 git clone https://github.com/jgm/pandoc
326 git clone https://github.com/jgm/cmark-hs
327 git clone https://github.com/jgm/zip-archive
328 cd pandoc
329 stack install --test --install-ghc --stack-yaml stack.full.yaml
331To pull in the latest changes, after you've done this and there have been
332changes in the repositories: Visit each repository in pandoc-build
333(pandoc-types, texmath, pandoc-citeproc, pandoc, zip-archive, cmark-hs) and do
334`git pull`. In the pandoc repo, also do `stack install --test
335--stack-yaml stack.full.yaml`.
338[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
339[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
340[Debian]: http://packages.debian.org/lenny/pandoc
341[Fedora]: https://apps.fedoraproject.org/packages/pandoc
342[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/
343[GHC]: http://www.haskell.org/ghc/
344[GPL]: http://www.gnu.org/copyleft/gpl.html
345[Haskell platform]: http://hackage.haskell.org/platform/
346[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
347[MacTeX]: https://tug.org/mactex/
348[NetBSD]: http://pkgsrc.se/wip/pandoc
349[NixOS]: http://nixos.org/nixos/
350[Slackware]: http://www.linuxpackages.net/search_view.php?by=name&name=pandoc&ver=
351[Ubuntu]: http://www.ubuntu.com
352[download page]: https://github.com/jgm/pandoc/releases/latest
353[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
354[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
355[openSUSE]: https://software.opensuse.org/package/pandoc
356[source tarball]: http://hackage.haskell.org/package/pandoc
357[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html
358[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
359[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl