Once upon a time I used Corel Draw to edit vector graphics. Now I'm looking at using Sketch. I previously converted all my old CDR files to PDF but Sketch doesn't seem to like to open PDFs containing vector graphics. Is there a free command-line program I can use to convert PDF to SVG?

  • 1
    Are you sure that the conversion from CDR to PDF didn't destroy all vector information (by just rendering a bitmap into the PDF)?
    – nohillside
    Oct 5, 2012 at 7:04
  • Yes. The PDFs are vectors.
    – SSteve
    Oct 5, 2012 at 14:56
  • @nohillside Isn't it more important to state the goal as lossless: pure vector source (to pure vector PDF) to pure vector SVG? Sep 16, 2019 at 9:50
  • @LangLangC Probably. It's an old question though, things may have changed a lot since 2012.
    – nohillside
    Sep 16, 2019 at 10:03
  • @benwiggy what is your objection to installing Inkscape? It has a proper MacOS installer and you are going to have to install something.
    – Old Pro
    Aug 14, 2020 at 19:24

4 Answers 4


Turns out Inkscape has a command line mode. I added this to .bash_profile:

alias inkscape="/Applications/Inkscape.app/Contents/Resources/bin/inkscape"

and now this command converts from PDF to SVG:

inkscape Logo.pdf --export-plain-svg=Logo.svg

Unfortunately, the current version of Sketch has very rudimentary SVG import capabilities and can't correctly read any of the files I've made even though they display fine in Opera and OmniWeb. The company says future versions will do better.

  • inkscape cannot open Figma exported SVGs... at least not on macOS. 🤢
    – Jonny
    Jun 29, 2018 at 9:17
  • 1
    --export-plain-svg is deprecated now. You should use --export-filename (or just -o for short) instead. So, that is inkscape Logo.pdf -o Logo.svg
    – postylem
    Jul 29, 2021 at 17:00
  • For anyone trying this nowadays: The brew package with inkscape 1.3.2 does not have this binary at the path in the answer. Instead, the binary is in /opt/homebrew/bin/inkscape.
    – oarfish
    Jan 2 at 11:29

My own research has so far led me thus:

There is a command line tool called PDF2SVG, which would be ideal, but it requires you to build it yourself and install all the necessary dependencies, including two libraries, Cairo and Poppler. (I tried installing Cairo, but it wanted pkg-config, which in turn reported that some other library was missing....)

The only decent tool I've found is MuPDF, which contains a CLI utility called mutool. You still have to build it yourself, but it is at least self-contained.

Download the source code;
unzip the package,
in the Terminal type cd (followed by a space),
then drag the unzipped folder from the Finder into the Terminal window.

Press Enter. Then type sudo make prefix=/usr/local install and enter your password.

You can then delete the source code.

Then you can convert PDFs to SVG using such commands as:

mutool convert -F svg -o filename.svg inputfile

If there are multiple pages, the page number will be appended to each filename. Either the -F flag or the -o flag is optional. But not both.

MuPDF is made by the people who make GhostScript, so should be reliable.

  • brew install pdf2svg Meaning: This can be installed via Homebrew which itself can be installed with just one command line, being the most convenient and hence most popular package manager on macOS for the last years anyhow.
    – porg
    Sep 21, 2021 at 18:56

Answer for 2020 (an update was asked for):

PDF rendering is hard to do well. There are not a lot of tools for it.

  • Inkscape remains a good, free option and is now available as a first-class Mac App for OS X 10.11-10.15 and it has a command-line interface
  • There are various packages for NodeJS that can do it, most of which leverage PDF.js and are not well-maintained, but installing NodeJS just for this purpose would be overkill
  • There are commercial packages like BuildVu if you can afford a 4-figure annual license fee
  • There are lots of cloud-based converters (both free and paid) which have command line clients or which you could script with curl, but that is not my idea of a command line program to do conversion

ImageMagick has a command line tool called convert which does all sorts of things in addition to converting file formats. There are lots of options, but the simplest way would be to do

convert file.pdf file.svg

That might not give the best quality, so you may need some flags such as -density - check the man pages. ImageMagick can likely be installed through fink/macports/homebrew.

  • the convert is one hell of a great command. It's already present in OSX. Oct 5, 2012 at 17:39
  • 9
    I did some tests with ImageMagick/convert and wasn't getting anything useful. So I did some looking around and found this page which says in bold letters: Avoid using ImageMagick for "Vector Image" to "Vector Image" conversions. Turns out it converts everything to raster format internally. So the hunt is still on…
    – SSteve
    Oct 5, 2012 at 18:17
  • Interesting find. I was unaware of the internal rasterization.
    – cm2
    Oct 5, 2012 at 22:11

You must log in to answer this question.

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