git.iko.soy/typeable/pandoc
on rc/2.11.0.3 help sign in
typeable/pandoc/INSTALL.md
426 lines 14 kB history raw
1# Installing pandoc
3The simplest way to get the latest pandoc release is to use the installer.
5<a href="https://github.com/jgm/pandoc/releases/latest"
6 class="btn btn-primary" id="downloadInstallerBtn">
7 Download the latest installer
8</a>
10For alternative ways to install pandoc, see below
11under the heading for your operating system.
13## Windows
15There is a package installer at pandoc's [download page].
16This will install pandoc, replacing older versions, and
17update your path to include the directory where pandoc's
18binaries are installed.
20If you prefer not to use the msi installer, we also provide
21a zip file that contains pandoc's binaries and
22documentation. Simply unzip this file and move the binaries
23to a directory of your choice.
25Alternatively, you can install pandoc using
26[Chocolatey](https://chocolatey.org):
28 choco install pandoc
30Chocolatey can also install other software that integrates with Pandoc.
31For example, to install `rsvg-convert` (from [librsvg], covering formats
32without SVG support), [Python] (to use Pandoc filters), and
33[MiKTeX] (to typeset PDFs with [LaTeX]):
35 choco install rsvg-convert python miktex
37By default, Pandoc creates PDFs using LaTeX.
38We recommend installing it via [MiKTeX].
40## macOS
42There is a package installer at pandoc's [download page].
43If you later want to uninstall the package, you can do so
44by downloading [this script][uninstaller]
45and running it with `perl uninstall-pandoc.pl`.
47Alternatively, you can install pandoc using
48[Homebrew](http://brew.sh):
50 brew install pandoc
52To include pandoc's citation parser:
54 brew install pandoc-citeproc
56Homebrew can also install other software that integrates with Pandoc.
57For example, to install [librsvg] (its `rsvg-convert` covers formats
58without SVG support), [Python] (to use Pandoc filters), and
59[BasicTeX] (to typeset PDFs with [LaTeX]):
61 brew install librsvg python homebrew/cask/basictex
63Note: On unsupported versions of macOS (more than three releases old),
64Homebrew installs from source, which takes additional time and disk space
65for the `ghc` compiler and dependent Haskell libraries.
67We also provide a zip file containing the binaries and man
68pages, for those who prefer not to use the installer. Simply
69unzip the file and move the binaries and man pages to
70whatever directory you like.
72By default, Pandoc creates PDFs using LaTeX. Because a full [MacTeX]
73installation uses four gigabytes of disk space, we recommend
74[BasicTeX] or [TinyTeX](https://yihui.org/tinytex/)
75and using the `tlmgr` tool to install additional packages
76as needed. If you receive errors warning of fonts not found:
78 tlmgr install collection-fontsrecommended
80## Linux
82Check whether the pandoc version in your package manager is
83not outdated. Pandoc is in the [Debian], [Ubuntu], [Slackware],
84[Arch], [Fedora], [NiXOS], [openSUSE], [gentoo] and [Void] repositories.
86To get the latest release, we provide a binary package for amd64
87architecture on the **[download page]**.
89This provides both `pandoc` and `pandoc-citeproc`.
90The executables are statically linked and
91have no dynamic dependencies or dependencies on external
92data files. Note: because of the static
93linking, the pandoc binary from this package cannot use lua
94filters that require external lua modules written in C.
96Both a tarball and a deb installer are provided. To install the deb:
98 sudo dpkg -i $DEB
100where `$DEB` is the path to the downloaded deb. This will
101install the `pandoc` and `pandoc-citeproc` executables and
102man pages.
104If you use an RPM-based distro, you may be able to install
105the deb from our download page using `alien`.
107On any distro, you may install from the tarball into `$DEST`
108(say, `/usr/local/` or `$HOME/.local`) by doing
110 tar xvzf $TGZ --strip-components 1 -C $DEST
112where `$TGZ` is the path to the downloaded zipped tarball.
113For Pandoc versions before 2.0, which don't provide
114a tarball, try instead
116 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $DEST
118You can also install from source, using the
119instructions below under [Compiling from source].
120Note that most distros have the Haskell platform in their
121package repositories. For example, on Debian/Ubuntu,
122you can install it with `apt-get install haskell-platform`.
124For PDF output, you'll need LaTeX. We recommend installing
125[TeX Live](http://www.tug.org/texlive/) via your package
126manager. (On Debian/Ubuntu, `apt-get install texlive`.)
128## Chrome OS
130On Chrome OS, pandoc can be installed using the
131[chromebrew](https://github.com/skycocker/chromebrew) package manager
132with the command:
134```sh
135crew install pandoc
136```
138This will automatically build and configure pandoc for the specific
139device you are using.
141## BSD
143Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
145## Docker
147The official Docker images for pandoc can be found at
148<https://github.com/pandoc/dockerfiles> and at
149[dockerhub](https://hub.docker.com/).
151The [pandoc/core](https://hub.docker.com/r/pandoc/core)
152image contains `pandoc` and `pandoc-citeproc`.
154The [pandoc/latex](https://hub.docker.com/r/pandoc/latex)
155image also contains the minimal LaTeX installation needed
156to produce PDFs using pandoc.
158To run pandoc using Docker, converting `README.md` to `README.pdf`:
160 docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/latex README.md -o README.pdf
162## GitHub Actions
164Pandoc can be run through
165[GitHub Actions](https://github.com/features/actions). For some
166examples, see <https://github.com/pandoc/pandoc-action-example>.
168## Compiling from source
170If for some reason a binary package is not available for your
171platform, or if you want to hack on pandoc or use a non-released
172version, you can install from source.
174### Getting the pandoc source code
176Source tarballs can be found at
177<https://hackage.haskell.org/package/pandoc>. For example, to
178fetch the source for version 1.17.0.3:
180 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
181 tar xvzf pandoc-1.17.0.3.tar.gz
182 cd pandoc-1.17.0.3
184Or you can fetch the development code by cloning the repository:
186 git clone https://github.com/jgm/pandoc
187 cd pandoc
189Note: there may be times when the development code is broken
190or depends on other libraries which must be installed
191separately. Unless you really know what you're doing, install
192the last released version.
194### Quick stack method
196The easiest way to build pandoc from source is to use [stack][stack]:
1981. Install [stack][stack]. Note that Pandoc requires stack >= 1.7.0.
2002. Change to the pandoc source directory and issue the following commands:
202 stack setup
203 stack install
205 `stack setup` will automatically download the ghc compiler
206 if you don't have it. `stack install` will install the
207 `pandoc` executable into `~/.local/bin`, which you should
208 add to your `PATH`. This process will take a while, and
209 will consume a considerable amount of disk space.
211### Quick cabal method
2131. Install the [Haskell platform]. This will give you [GHC] and
214 the [cabal-install] build tool. Note that pandoc requires
215 GHC >= 7.10 and cabal >= 2.0.
2172. Update your package database:
219 cabal update
2213. Check your cabal version with
223 cabal --version
225 If you have a version less than 2.0, install the latest with:
227 cabal install cabal-install
2294. Use `cabal` to install pandoc and its dependencies:
231 cabal install pandoc
233 This procedure will install the released version of pandoc,
234 which will be downloaded automatically from HackageDB.
236 If you want to install a modified or development version
237 of pandoc instead, switch to the source directory and do
238 as above, but without the 'pandoc':
240 cabal install
2425. Make sure the `$CABALDIR/bin` directory is in your path. You should
243 now be able to run `pandoc`:
245 pandoc --help
247 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
2495. If you want to process citations with pandoc, you will also need to
250 install a separate package, `pandoc-citeproc`. This can be installed
251 using cabal:
253 cabal install pandoc-citeproc
255 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
256 to sort bibliography entries (RFC 5051). If you would like to
257 use the locale-sensitive unicode collation algorithm instead,
258 specify the `unicode_collation` flag:
260 cabal install pandoc-citeproc -funicode_collation
262 Note that this requires the `text-icu` library, which in turn
263 depends on the C library `icu4c`. Installation directions
264 vary by platform. Here is how it might work on macOS with Homebrew:
266 brew install icu4c
267 stack install pandoc-citeproc \
268 --flag "pandoc-citeproc:unicode_collation" \
269 --extra-lib-dirs=/usr/local/opt/icu4c/lib \
270 --extra-include-dirs=/usr/local/opt/icu4c/include
2726. The `pandoc.1` man page will be installed automatically. cabal shows
273 you where it is installed: you may need to set your `MANPATH`
274 accordingly. If `MANUAL.txt` has been modified, the man page can be
275 rebuilt: `make man/pandoc.1`.
277 The `pandoc-citeproc.1` man page will also be installed automatically.
280### Custom cabal method
282This is a step-by-step procedure that offers maximal control
283over the build and installation. Most users should use the
284quick install, but this information may be of use to packagers.
285For more details, see the [Cabal User's Guide]. These instructions
286assume that the pandoc source directory is your working directory.
287You will need cabal version 2.0 or higher.
2891. Install dependencies: in addition to the [Haskell platform],
290 you will need a number of additional libraries. You can install
291 them all with
293 cabal update
294 cabal install --only-dependencies
2962. Configure:
298 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
299 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
300 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
301 --mandir=DIR --flags=FLAGSPEC --enable-tests
303 All of the options have sensible defaults that can be overridden
304 as needed.
306 `FLAGSPEC` is a list of Cabal configuration flags, optionally
307 preceded by a `-` (to force the flag to `false`), and separated
308 by spaces. Pandoc's flags include:
310 - `embed_data_files`: embed all data files into the binary (default no).
311 This is helpful if you want to create a relocatable binary.
313 - `https`: enable support for downloading resources over https
314 (using the `http-client` and `http-client-tls` libraries).
3163. Build:
318 cabal build
319 cabal test
3214. Build API documentation:
323 cabal haddock --html-location=URL --hyperlink-source
3255. Copy the files:
327 cabal copy --destdir=PATH
329 The default destdir is `/`.
3316. Register pandoc as a GHC package:
333 cabal register
335 Package managers may want to use the `--gen-script` option to
336 generate a script that can be run to register the package at
337 install time.
339### Creating a relocatable binary
341It is possible to compile pandoc such that the data files
342pandoc uses are embedded in the binary. The resulting binary
343can be run from any directory and is completely self-contained.
344With cabal, add `-fembed_data_files` to the `cabal configure`
345or `cabal install` commands.
347With stack, use `--flag pandoc:embed_data_files`.
351### Running tests
353Pandoc comes with an automated test suite.
354To run with cabal, `cabal test`; to run with stack, `stack
355test`.
357To run particular tests (pattern-matching on their names), use
358the `-p` option:
360 cabal install pandoc --enable-tests
361 cabal test --test-options='-p markdown'
363Or with stack:
365 stack test --test-arguments='-p markdown'
367It is often helpful to add `-j4` (run tests in parallel)
368and `--hide-successes` (don't clutter output with successes)
369to the test arguments as well.
371If you add a new feature to pandoc, please add tests as well, following
372the pattern of the existing tests. The test suite code is in
373`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
374probably easiest to add some data files to the `test` directory, and
375modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
376under the `test/Tests` hierarchy corresponding to the pandoc module you
377are changing.
379### Running benchmarks
381To build and run the benchmarks:
383 cabal configure --enable-benchmarks && cabal build
384 cabal bench
386or with stack:
388 stack bench
390To use a smaller sample size so the benchmarks run faster:
392 cabal bench --benchmark-options='-s 20'
394To run just the markdown benchmarks:
396 cabal bench --benchmark-options='markdown'
399[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
400[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
401[Debian]: https://packages.debian.org/pandoc
402[Fedora]: https://apps.fedoraproject.org/packages/pandoc
403[FreeBSD ports]: http://www.freshports.org/textproc/hs-pandoc/
404[GHC]: http://www.haskell.org/ghc/
405[GPL]: http://www.gnu.org/copyleft/gpl.html
406[Haskell platform]: http://hackage.haskell.org/platform/
407[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
408[MacTeX]: https://tug.org/mactex/
409[BasicTeX]: http://www.tug.org/mactex/morepackages.html
410[LaTeX]: https://www.latex-project.org
411[MiKTeX]: http://miktex.org/
412[librsvg]: https://wiki.gnome.org/Projects/LibRsvg
413[Python]: https://www.python.org
414[NetBSD]: http://pkgsrc.se/wip/pandoc
415[NixOS]: https://nixos.org/nixos/packages.html
416[Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=
417[Ubuntu]: https://packages.ubuntu.com/pandoc
418[download page]: https://github.com/jgm/pandoc/releases/latest
419[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
420[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
421[openSUSE]: https://software.opensuse.org/package/pandoc
422[source tarball]: http://hackage.haskell.org/package/pandoc
423[stack]: https://docs.haskellstack.org/en/stable/install_and_upgrade.html
424[cabal-install]: http://hackage.haskell.org/package/cabal-install
425[Void]: https://voidlinux.org/
426[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl