git.iko.soy/typeable/pandoc
on rc/2.11.3.1 help sign in
typeable/pandoc/INSTALL.md
412 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
52Homebrew can also install other software that integrates with Pandoc.
53For example, to install [librsvg] (its `rsvg-convert` covers formats
54without SVG support), [Python] (to use Pandoc filters), and
55[BasicTeX] (to typeset PDFs with [LaTeX]):
57 brew install librsvg python homebrew/cask/basictex
59Note: On unsupported versions of macOS (more than three releases old),
60Homebrew installs from source, which takes additional time and disk space
61for the `ghc` compiler and dependent Haskell libraries.
63We also provide a zip file containing the binaries and man
64pages, for those who prefer not to use the installer. Simply
65unzip the file and move the binaries and man pages to
66whatever directory you like.
68By default, Pandoc creates PDFs using LaTeX. Because a full [MacTeX]
69installation uses four gigabytes of disk space, we recommend
70[BasicTeX] or [TinyTeX](https://yihui.org/tinytex/)
71and using the `tlmgr` tool to install additional packages
72as needed. If you receive errors warning of fonts not found:
74 tlmgr install collection-fontsrecommended
76## Linux
78Check whether the pandoc version in your package manager is
79not outdated. Pandoc is in the [Debian], [Ubuntu], [Slackware],
80[Arch], [Fedora], [NiXOS], [openSUSE], [gentoo] and [Void] repositories.
82To get the latest release, we provide a binary package for amd64
83architecture on the **[download page]**.
85The executable is statically linked and
86has no dynamic dependencies or dependencies on external
87data files. Note: because of the static
88linking, the pandoc binary from this package cannot use lua
89filters that require external lua modules written in C.
91Both a tarball and a deb installer are provided. To install the deb:
93 sudo dpkg -i $DEB
95where `$DEB` is the path to the downloaded deb. This will
96install the `pandoc` executable and man page.
98If you use an RPM-based distro, you may be able to install
99the deb from our download page using `alien`.
101On any distro, you may install from the tarball into `$DEST`
102(say, `/usr/local/` or `$HOME/.local`) by doing
104 tar xvzf $TGZ --strip-components 1 -C $DEST
106where `$TGZ` is the path to the downloaded zipped tarball.
107For Pandoc versions before 2.0, which don't provide
108a tarball, try instead
110 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $DEST
112You can also install from source, using the
113instructions below under [Compiling from source].
114Note that most distros have the Haskell platform in their
115package repositories. For example, on Debian/Ubuntu,
116you can install it with `apt-get install haskell-platform`.
118For PDF output, you'll need LaTeX. We recommend installing
119[TeX Live](http://www.tug.org/texlive/) via your package
120manager. (On Debian/Ubuntu, `apt-get install texlive`.)
122## Chrome OS
124On Chrome OS, pandoc can be installed using the
125[chromebrew](https://github.com/skycocker/chromebrew) package manager
126with the command:
128```sh
129crew install pandoc
130```
132This will automatically build and configure pandoc for the specific
133device you are using.
135## BSD
137Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
139## Docker
141The official Docker images for pandoc can be found at
142<https://github.com/pandoc/dockerfiles> and at
143[dockerhub](https://hub.docker.com/).
145The [pandoc/core](https://hub.docker.com/r/pandoc/core)
146image contains `pandoc`.
148The [pandoc/latex](https://hub.docker.com/r/pandoc/latex)
149image also contains the minimal LaTeX installation needed
150to produce PDFs using pandoc.
152To run pandoc using Docker, converting `README.md` to `README.pdf`:
154 docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/latex README.md -o README.pdf
156## GitHub Actions
158Pandoc can be run through
159[GitHub Actions](https://github.com/features/actions). For some
160examples, see <https://github.com/pandoc/pandoc-action-example>.
162## Compiling from source
164If for some reason a binary package is not available for your
165platform, or if you want to hack on pandoc or use a non-released
166version, you can install from source.
168### Getting the pandoc source code
170Source tarballs can be found at
171<https://hackage.haskell.org/package/pandoc>. For example, to
172fetch the source for version 1.17.0.3:
174 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
175 tar xvzf pandoc-1.17.0.3.tar.gz
176 cd pandoc-1.17.0.3
178Or you can fetch the development code by cloning the repository:
180 git clone https://github.com/jgm/pandoc
181 cd pandoc
183Note: there may be times when the development code is broken
184or depends on other libraries which must be installed
185separately. Unless you really know what you're doing, install
186the last released version.
188### Quick stack method
190The easiest way to build pandoc from source is to use [stack][stack]:
1921. Install [stack][stack]. Note that Pandoc requires stack >= 1.7.0.
1942. Change to the pandoc source directory and issue the following commands:
196 stack setup
197 stack install
199 `stack setup` will automatically download the ghc compiler
200 if you don't have it. `stack install` will install the
201 `pandoc` executable into `~/.local/bin`, which you should
202 add to your `PATH`. This process will take a while, and
203 will consume a considerable amount of disk space.
205### Quick cabal method
2071. Install the [Haskell platform]. This will give you [GHC] and
208 the [cabal-install] build tool. Note that pandoc requires
209 GHC >= 7.10 and cabal >= 2.0.
2112. Update your package database:
213 cabal update
2153. Check your cabal version with
217 cabal --version
219 If you have a version less than 2.0, install the latest with:
221 cabal install cabal-install
2234. Use `cabal` to install pandoc and its dependencies:
225 cabal install pandoc
227 This procedure will install the released version of pandoc,
228 which will be downloaded automatically from HackageDB.
230 If you want to install a modified or development version
231 of pandoc instead, switch to the source directory and do
232 as above, but without the 'pandoc':
234 cabal install
2365. Make sure the `$CABALDIR/bin` directory is in your path. You should
237 now be able to run `pandoc`:
239 pandoc --help
241 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
2435. By default `pandoc` uses the "i;unicode-casemap" method
244 to sort bibliography entries (RFC 5051). If you would like to
245 use the locale-sensitive unicode collation algorithm instead,
246 specify the `icu` flag (which affects the dependency `citeproc`):
248 cabal install pandoc -ficu
250 Note that this requires the `text-icu` library, which in turn
251 depends on the C library `icu4c`. Installation directions
252 vary by platform. Here is how it might work on macOS with Homebrew:
254 brew install icu4c
255 stack install pandoc \
256 --flag "citeproc:icu" \
257 --extra-lib-dirs=/usr/local/opt/icu4c/lib \
258 --extra-include-dirs=/usr/local/opt/icu4c/include
2606. The `pandoc.1` man page will be installed automatically. cabal shows
261 you where it is installed: you may need to set your `MANPATH`
262 accordingly. If `MANUAL.txt` has been modified, the man page can be
263 rebuilt: `make man/pandoc.1`.
266### Custom cabal method
268This is a step-by-step procedure that offers maximal control
269over the build and installation. Most users should use the
270quick install, but this information may be of use to packagers.
271For more details, see the [Cabal User's Guide]. These instructions
272assume that the pandoc source directory is your working directory.
273You will need cabal version 2.0 or higher.
2751. Install dependencies: in addition to the [Haskell platform],
276 you will need a number of additional libraries. You can install
277 them all with
279 cabal update
280 cabal install --only-dependencies
2822. Configure:
284 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
285 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
286 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
287 --mandir=DIR --flags=FLAGSPEC --enable-tests
289 All of the options have sensible defaults that can be overridden
290 as needed.
292 `FLAGSPEC` is a list of Cabal configuration flags, optionally
293 preceded by a `-` (to force the flag to `false`), and separated
294 by spaces. Pandoc's flags include:
296 - `embed_data_files`: embed all data files into the binary (default no).
297 This is helpful if you want to create a relocatable binary.
299 - `https`: enable support for downloading resources over https
300 (using the `http-client` and `http-client-tls` libraries).
3023. Build:
304 cabal build
305 cabal test
3074. Build API documentation:
309 cabal haddock --html-location=URL --hyperlink-source
3115. Copy the files:
313 cabal copy --destdir=PATH
315 The default destdir is `/`.
3176. Register pandoc as a GHC package:
319 cabal register
321 Package managers may want to use the `--gen-script` option to
322 generate a script that can be run to register the package at
323 install time.
325### Creating a relocatable binary
327It is possible to compile pandoc such that the data files
328pandoc uses are embedded in the binary. The resulting binary
329can be run from any directory and is completely self-contained.
330With cabal, add `-fembed_data_files` to the `cabal configure`
331or `cabal install` commands.
333With stack, use `--flag pandoc:embed_data_files`.
337### Running tests
339Pandoc comes with an automated test suite.
340To run with cabal, `cabal test`; to run with stack, `stack
341test`.
343To run particular tests (pattern-matching on their names), use
344the `-p` option:
346 cabal install pandoc --enable-tests
347 cabal test --test-options='-p markdown'
349Or with stack:
351 stack test --test-arguments='-p markdown'
353It is often helpful to add `-j4` (run tests in parallel)
354and `--hide-successes` (don't clutter output with successes)
355to the test arguments as well.
357If you add a new feature to pandoc, please add tests as well, following
358the pattern of the existing tests. The test suite code is in
359`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
360probably easiest to add some data files to the `test` directory, and
361modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
362under the `test/Tests` hierarchy corresponding to the pandoc module you
363are changing.
365### Running benchmarks
367To build and run the benchmarks:
369 cabal configure --enable-benchmarks && cabal build
370 cabal bench
372or with stack:
374 stack bench
376To use a smaller sample size so the benchmarks run faster:
378 cabal bench --benchmark-options='-s 20'
380To run just the markdown benchmarks:
382 cabal bench --benchmark-options='markdown'
385[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
386[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
387[Debian]: https://packages.debian.org/pandoc
388[Fedora]: https://apps.fedoraproject.org/packages/pandoc
389[FreeBSD ports]: http://www.freshports.org/textproc/hs-pandoc/
390[GHC]: http://www.haskell.org/ghc/
391[GPL]: http://www.gnu.org/copyleft/gpl.html
392[Haskell platform]: http://hackage.haskell.org/platform/
393[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
394[MacTeX]: https://tug.org/mactex/
395[BasicTeX]: http://www.tug.org/mactex/morepackages.html
396[LaTeX]: https://www.latex-project.org
397[MiKTeX]: http://miktex.org/
398[librsvg]: https://wiki.gnome.org/Projects/LibRsvg
399[Python]: https://www.python.org
400[NetBSD]: http://pkgsrc.se/wip/pandoc
401[NixOS]: https://nixos.org/nixos/packages.html
402[Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=
403[Ubuntu]: https://packages.ubuntu.com/pandoc
404[download page]: https://github.com/jgm/pandoc/releases/latest
405[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
406[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
407[openSUSE]: https://software.opensuse.org/package/pandoc
408[source tarball]: http://hackage.haskell.org/package/pandoc
409[stack]: https://docs.haskellstack.org/en/stable/install_and_upgrade.html
410[cabal-install]: http://hackage.haskell.org/package/cabal-install
411[Void]: https://voidlinux.org/
412[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl