jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.97k stars 3.34k forks source link

`brew install pandoc` on OS X did not create a --data-dir #8593

Closed gotofritz closed 1 year ago

gotofritz commented 1 year ago

Explain the problem. I installed pandoc with homebrew

❯ brew install pandoc
Running `brew update --auto-update`...
==> Fetching pandoc
==> Downloading https://ghcr.io/v2/homebrew/core/pandoc/manifests/3.0.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pandoc/blobs/sha256:4f8e02800d59dd0f6f48de7ae0a98d741e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4f8e02800d59dd0f6f
######################################################################## 100.0%
==> Pouring pandoc--3.0.1.arm64_ventura.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d
==> Summary
🍺  /opt/homebrew/Cellar/pandoc/3.0.1: 10 files, 236.7MB
==> Running `brew cleanup pandoc`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
...

The tool works, but no conversion is possible because there are no templates. That's because there is no --data-dir, even though pandoc thinks there is one

❯ pandoc --version
pandoc 3.0.1
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/fritz/.local/share/pandoc
...

❯ ls /Users/fritz/.local/share/pandoc
ls: /Users/fritz/.local/share/pandoc: No such file or directory

Pandoc version? 3.0.1 / OS X 13.1

gotofritz commented 1 year ago

I have tried the .pkg installer afterwards, it run all the way through, but it still didn't install any templates.

I noticed that the the installer in github doesn't include the templates, so that tells me it's by design. If that's the case the documentation is out of date, because it's not mentioned anywhere

https://github.com/jgm/pandoc/releases/download/3.0.1/pandoc-3.0.1-macOS.zip

❯ tree ~/Downloads/pandoc-3.0.1/
/Users/fritz/Downloads/pandoc-3.0.1/
├── bin
│   ├── pandoc
│   ├── pandoc-lua -> pandoc
│   └── pandoc-server -> pandoc
└── share
    └── man
        └── man1
            ├── pandoc-lua.1
            ├── pandoc-server.1
            └── pandoc.1
jgm commented 1 year ago

The default templates should be baked into the binary. You only need to create a user data dir if you want to override the defaults. Pandoc won't create it for you because it likes to "leave no trace" on your file system.

gotofritz commented 1 year ago

Yep, I figured it in the end - my first attempt was a conversation to csv, and I naively assumed it would be baked in because it's so simple and widespread, and if it wasn't something must have been broken. I later realised my mistake. Thanks for your answer!