How to Convert .md to PDF on Mac

4 methods — from one-click to command line

Why Convert Markdown to PDF?

Markdown files are great for writing and version control, but sometimes you need a PDF: to share a document with someone who doesn't have a Markdown viewer, to submit a report, or to print a spec. macOS makes this straightforward once you know where to look.

Method 1: Print → Save as PDF (Easiest)

This works from any app that can render Markdown — including MDViewer.

  1. Open the .md file in a Markdown viewer
  2. Press ⌘P to open the Print dialog
  3. Click PDF in the bottom-left corner
  4. Choose Save as PDF
  5. Pick a filename and location, click Save

This preserves the rendered formatting — headings, bold, code blocks, lists — exactly as they appear on screen. The output quality depends on the app you're printing from, so using a dedicated Markdown viewer gives the best results.

Method 2: Pandoc (Command Line)

Pandoc is a powerful document converter that runs in the terminal. It produces high-quality PDFs with full control over styling.

  1. Install Pandoc: brew install pandoc
  2. Install a PDF engine (if needed): brew install --cask basictex
  3. Convert: pandoc README.md -o README.pdf

Pandoc supports tables, footnotes, math, and custom templates. It is the best option for batch conversion or automated pipelines.

Method 3: VS Code Markdown PDF Extension

If you already use VS Code:

  1. Install the Markdown PDF extension
  2. Open the .md file
  3. Open the Command Palette (⌘⇧P)
  4. Type Markdown PDF: Export (pdf)

Quick and convenient if VS Code is already your editor, but it launches a full IDE just to convert a file.

Method 4: grip + Chrome (GitHub-Style PDF)

If you want the output to look exactly like GitHub renders your Markdown:

  1. Install grip: pip install grip
  2. Run: grip README.md
  3. Open localhost:6419 in Chrome
  4. Press ⌘PSave as PDF

Grip renders Markdown using GitHub's API, so the output matches GitHub's styling perfectly — ideal for READMEs and project documentation.

Which Method Should You Use?

  • Quick one-off? — Open in MDViewer, ⌘P, Save as PDF
  • Batch conversion or CI? — Pandoc
  • Already in VS Code? — Markdown PDF extension
  • Need GitHub-exact styling? — grip

For most people, the Print → Save as PDF method is the fastest. You just need a Markdown viewer that renders the file well.

View Your Markdown Files with MDViewer

MDViewer is a free, native macOS app for reading and editing .md files. Open any Markdown file, see it rendered instantly, and print to PDF when you need to share.

  • Renders GitHub Flavored Markdown — tables, task lists, code blocks
  • Set as your default .md app — double-click in Finder to open
  • Inline editing — fix and save without switching apps
  • Launches instantly — native SwiftUI, no Electron overhead
Download MDViewer for Free

Requires macOS 13.0 or later. Intel and Apple Silicon.