5

I am trying to use dvisvgm to convert pdf files to svg files. When I call dvisvgm --pdf test.pdf (for example), I get the response ERROR: Ghostscript is required to process PDF files. Both programs are installed via MacTeX-2020 on macOS Catalina, and both programs are in my path (calling both dvisvgm and gs in the terminal is successful). I have even tried this on a clean install of macOS Catalina with nothing else but MacTeX-2020 installed, with the same result.

Any help would be greatly appreciated!

2
  • 1
    dvisvgm requires the Ghostscript library not the executable. So you have to ensure that libgs.dylib.9 (or the like) is accessible by the dynamic linker. Otherwise, you can specify its path using environment variable LIBGS or dvisvgm option --libgs. There's also some information about it on the dvisvgm manual page.
    – Martin
    Aug 22, 2020 at 18:33
  • @Martin, thanks for the info. MacTeX doesn't tell me exactly which file is the dynamic library that it installed, but, looking though my files, I think it must be /usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50 . But then running dvisvgm --libgs=/usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50 --pdf test.pdf gives exactly the same error message as before.
    – Paige
    Aug 22, 2020 at 18:43

3 Answers 3

2

You will have to download the Ghostscript 9.50 installer found near the bottom of the page at <https://www.tug.org/mactex/morepackages.html>. Then install but make sure, at the Installation Type step, to Customize and have it install the Ghostscript Dynamic Library.

Then do

export LIBGS=/usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50

before running dvisvgm --pdf ... I get it to work.

10
  • Thanks a lot for the help. I have installed the Ghostscript dynamic library and I do have the file /usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50 . After Martin's comment above, I ran dvisvgm --libgs=/usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50 --pdf test.pdf which produced exactly the same error message. Any chance you could point me a bit further in the right direction?
    – Paige
    Aug 22, 2020 at 19:02
  • Look at the order in my answer. The libgs argument goes last. That worked for me Aug 22, 2020 at 19:53
  • Running dvisvgm --pdf test.pdf −−libgs=/usr/local/share/ghostscript/9.50/lib/libgs.dylib.9.50 I still get ERROR: Ghostscript is required to process PDF files.
    – Paige
    Aug 22, 2020 at 19:57
  • Are you using TeX Live 2020? Assuming so there was an update to dvisvgm today. Try updating and see if it works. Aug 22, 2020 at 20:13
  • Sorry, the second method doesn't seem to work. However, if you export LIBGS as given above before running dvidvgm -pdf test.pdf it works fine. (Sigh.. I forgot that the LIBGS shell variable was already defined when I ran the second version.) Aug 22, 2020 at 20:44
2

I just heard from Richard Koch: Bruno Voison has tracked this one down in detail. In TeXLive 2023 (so MacTeX 2023 onwards), this will be fixed, so that (presumably) all that will be necessary is to install Ghostscript, and then dvisvgm will "just work". In the meantime, the above solutions will work.

Another possibility is to do the following:

$ sudo bash
Password:[type your password]
# chdir /Library/TeX/texbin
# mv dvisvgm dvisvgm.real
# cat > dvisvgm
#!/bin/sh

LIBGS=/usr/local/lib/libgs.9.dylib
export LIBGS
exec dvisvgm.real "$@"
[ctrl-D]
# chmod 755 dvisvgm
# exit
$ 

(where [ctrl-D] means hit the ctrl-D combination, not type the characters literally!).

1
  • Thank you very much, this did it for me, though I had to figure out some tweaking. If you use zsh instead of bash, just start with sudo chdir .... If cat > dvisvgm does not go through because of permission denied, instead create the file with nano: sudo nano dvisvgm. In this case, [ctrl-O] writes out the file you have just typed and [ctrl-X] closes the editor. Also make sure /usr/local/lib/libgs.9.dylib exists, I had version 10 instead.
    – Cryme
    Apr 13, 2023 at 15:34
0

In the newest MacTeX(Mar 2024), they've already given a solution.

  1. Go to https://www.tug.org/mactex/morepackages.html
  2. Scroll to the bottom
  3. Install Ghostscript.pkg
  4. Install GhostscriptExtras.pkg

Especially the last one, Extras, would be a decisive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .