git.iko.soy/typeable/pandoc
on 2.0.5 help sign in
typeable/pandoc/INSTALL.md
334 lines 12 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 - For PDF output, you'll also need to install LaTeX.
16 We recommend [MiKTeX](http://miktex.org/).
18## macOS
20 - You can install pandoc using
21 [homebrew](http://brew.sh): `brew install pandoc`.
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 - For PDF output, you'll also need LaTeX. Because a full [MacTeX]
34 installation takes more than a gigabyte of disk space, we recommend
35 installing [BasicTeX](http://www.tug.org/mactex/morepackages.html)
36 (64M) and using the `tlmgr` tool to install additional packages
37 as needed. If you get errors warning of fonts not found, try
39 tlmgr install collection-fontsrecommended
41## Linux
43 - First, try your package manager.
44 Pandoc is in the [Debian], [Ubuntu], [Slackware],
45 [Arch], [Fedora], [NiXOS], [openSUSE], and [gentoo] repositories.
46 Note, however, that versions in the repositories are often
47 old.
49 - We provide a binary package for amd64 architecture on
50 the [download page]. This provides both `pandoc` and
51 `pandoc-citeproc`. The executables are statically linked and
52 have no dynamic dependencies or dependencies on external
53 data files. Note: because of the static
54 linking, the pandoc binary from this package cannot use lua
55 filters that require external lua modules written in C.
57 Both a tarball and a deb installer are provided. To install the deb:
59 sudo dpkg -i $DEB
61 where `$DEB` is the path to the downloaded deb. This will
62 install the `pandoc` and `pandoc-citeproc` executables and
63 man pages.
65 If you use an RPM-based distro, you may be able to install
66 the deb from our download page using `alien`.
68 On any distro, you may install from the tarball into `$DEST`
69 (say, `/usr/local/` or `$HOME/.local`) by doing
71 tar xvzf $TGZ --strip-components 1 -C $DEST
73 where `$TGZ` is the path to the downloaded zipped tarball.
74 For Pandoc versions before 2.0, which don't provide
75 a tarball, try instead
77 ar p $DEB data.tar.gz | tar xvz --strip-components 2 -C $DEST
79 - You can also install from source, using the
80 instructions below under [Compiling from source].
81 Note that most distros have the Haskell platform in their
82 package repositories. For example, on Debian/Ubuntu,
83 you can install it with `apt-get install haskell-platform`.
85 - For PDF output, you'll need LaTeX. We recommend installing
86 [TeX Live](http://www.tug.org/texlive/) via your package
87 manager. (On Debian/Ubuntu, `apt-get install texlive`.)
89## BSD
91 - Pandoc is in the [NetBSD] and [FreeBSD ports] repositories.
93## Compiling from source
95If for some reason a binary package is not available for your
96platform, or if you want to hack on pandoc or use a non-released
97version, you can install from source.
99### Getting the pandoc source code
101Source tarballs can be found at
102<https://hackage.haskell.org/package/pandoc>. For example, to
103fetch the source for version 1.17.0.3:
105 wget https://hackage.haskell.org/package/pandoc-1.17.0.3/pandoc-1.17.0.3.tar.gz
106 tar xvzf pandoc-1.17.0.3.tar.gz
107 cd pandoc-1.17.0.3
109Or you can fetch the development code by cloning the repository:
111 git clone https://github.com/jgm/pandoc
112 cd pandoc
114Note: there may be times when the development code is broken
115or depends on other libraries which must be installed
116separately. Unless you really know what you're doing, install
117the last released version.
119### Quick stack method
121The easiest way to build pandoc from source is to use [stack]:
1231. Install [stack].
1252. Change to the pandoc source directory and issue the following commands:
127 stack setup
128 stack install --test
130 `stack setup` will automatically download the ghc compiler
131 if you don't have it. `stack install` will install the
132 `pandoc` executable into `~/.local/bin`, which you should
133 add to your `PATH`. This process will take a while, and
134 will consume a considerable amount of disk space.
136### Quick cabal method
1381. Install the [Haskell platform]. This will give you [GHC] and
139 the [cabal-install] build tool. Note that pandoc requires
140 GHC >= 7.8.
1422. Update your package database:
144 cabal update
1463. Use `cabal` to install pandoc and its dependencies:
148 cabal install pandoc --enable-tests
150 This procedure will install the released version of pandoc,
151 which will be downloaded automatically from HackageDB.
153 If you want to install a modified or development version
154 of pandoc instead, switch to the source directory and do
155 as above, but without the 'pandoc':
157 cabal install
1594. Make sure the `$CABALDIR/bin` directory is in your path. You should
160 now be able to run `pandoc`:
162 pandoc --help
164 [Not sure where `$CABALDIR` is?](http://www.haskell.org/haskellwiki/Cabal-Install#The_cabal-install_configuration_file)
1665. If you want to process citations with pandoc, you will also need to
167 install a separate package, `pandoc-citeproc`. This can be installed
168 using cabal:
170 cabal install pandoc-citeproc
172 By default `pandoc-citeproc` uses the "i;unicode-casemap" method
173 to sort bibliography entries (RFC 5051). If you would like to
174 use the locale-sensitive unicode collation algorithm instead,
175 specify the `unicode_collation` flag:
177 cabal install pandoc-citeproc -funicode_collation
179 Note that this requires the `text-icu` library, which in turn
180 depends on the C library `icu4c`. Installation directions
181 vary by platform. Here is how it might work on macOS with homebrew:
183 brew install icu4c
184 cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \
185 --extra-include-dirs=/usr/local/Cellar/icu4c/51.1/include \
186 -funicode_collation text-icu pandoc-citeproc
1886. The `pandoc.1` man page will be installed automatically. cabal shows
189 you where it is installed: you may need to set your `MANPATH`
190 accordingly. If `MANUAL.txt` has been modified, the man page can be
191 rebuilt: `make man/pandoc.1`.
193 The `pandoc-citeproc.1` man page will also be installed automatically.
196### Custom cabal method
198This is a step-by-step procedure that offers maximal control
199over the build and installation. Most users should use the
200quick install, but this information may be of use to packagers.
201For more details, see the [Cabal User's Guide]. These instructions
202assume that the pandoc source directory is your working directory.
2041. Install dependencies: in addition to the [Haskell platform],
205 you will need a number of additional libraries. You can install
206 them all with
208 cabal update
209 cabal install --only-dependencies
2112. Configure:
213 cabal configure --prefix=DIR --bindir=DIR --libdir=DIR \
214 --datadir=DIR --libsubdir=DIR --datasubdir=DIR --docdir=DIR \
215 --htmldir=DIR --program-prefix=PREFIX --program-suffix=SUFFIX \
216 --mandir=DIR --flags=FLAGSPEC --enable-tests
218 All of the options have sensible defaults that can be overridden
219 as needed.
221 `FLAGSPEC` is a list of Cabal configuration flags, optionally
222 preceded by a `-` (to force the flag to `false`), and separated
223 by spaces. Pandoc's flags include:
225 - `embed_data_files`: embed all data files into the binary (default no).
226 This is helpful if you want to create a relocatable binary.
228 - `https`: enable support for downloading resources over https
229 (using the `http-client` and `http-client-tls` libraries).
2313. Build:
233 cabal build
234 cabal test
2364. Build API documentation:
238 cabal haddock --html-location=URL --hyperlink-source
2405. Copy the files:
242 cabal copy --destdir=PATH
244 The default destdir is `/`.
2466. Register pandoc as a GHC package:
248 cabal register
250 Package managers may want to use the `--gen-script` option to
251 generate a script that can be run to register the package at
252 install time.
254### Creating a relocatable binary
256It is possible to compile pandoc such that the data files
257pandoc uses are embedded in the binary. The resulting binary
258can be run from any directory and is completely self-contained.
259With cabal, add `-fembed_data_files` to the `cabal configure`
260or `cabal install` commands.
262With stack, use `--flag pandoc:embed_data_files`.
266### Running tests
268Pandoc comes with an automated test suite.
269To run with cabal, `cabal test`; to run with stack, `stack
270test`.
272To run particular tests (pattern-matching on their names), use
273the `-p` option:
275 cabal test --test-options='-p markdown'
277Or with stack:
279 stack test --test-arguments='-p markdown'
281It is often helpful to add `-j4` (run tests in parallel)
282and `--hide-successes` (don't clutter output with successes)
283to the test arguments as well.
285If you add a new feature to pandoc, please add tests as well, following
286the pattern of the existing tests. The test suite code is in
287`test/test-pandoc.hs`. If you are adding a new reader or writer, it is
288probably easiest to add some data files to the `test` directory, and
289modify `test/Tests/Old.hs`. Otherwise, it is better to modify the module
290under the `test/Tests` hierarchy corresponding to the pandoc module you
291are changing.
293### Running benchmarks
295To build and run the benchmarks:
297 cabal configure --enable-benchmarks && cabal build
298 cabal bench
300or with stack:
302 stack bench
304To use a smaller sample size so the benchmarks run faster:
306 cabal bench --benchmark-options='-s 20'
308To run just the markdown benchmarks:
310 cabal bench --benchmark-options='markdown'
313[Arch]: https://www.archlinux.org/packages/community/x86_64/pandoc/
314[Cabal User's Guide]: http://www.haskell.org/cabal/release/latest/doc/users-guide/builders.html#setup-configure-paths
315[Debian]: https://packages.debian.org/pandoc
316[Fedora]: https://apps.fedoraproject.org/packages/pandoc
317[FreeBSD ports]: http://www.freshports.org/textproc/pandoc/
318[GHC]: http://www.haskell.org/ghc/
319[GPL]: http://www.gnu.org/copyleft/gpl.html
320[Haskell platform]: http://hackage.haskell.org/platform/
321[MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile
322[MacTeX]: https://tug.org/mactex/
323[NetBSD]: http://pkgsrc.se/wip/pandoc
324[NixOS]: https://nixos.org/nixos/packages.html
325[Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=
326[Ubuntu]: https://packages.ubuntu.com/pandoc
327[download page]: https://github.com/jgm/pandoc/releases/latest
328[gentoo]: http://packages.gentoo.org/package/app-text/pandoc
329[haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D
330[openSUSE]: https://software.opensuse.org/package/pandoc
331[source tarball]: http://hackage.haskell.org/package/pandoc
332[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html
333[cabal-install]: http://hackage.haskell.org/trac/hackage/wiki/CabalInstall
334[uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl