A macOS installer that creates a native app for converting Markdown files to PDF. Double-click any .md file to convert and view it in Preview.
- macOS (Apple Silicon or Intel)
- Xcode Command Line Tools when Homebrew, pandoc, or weasyprint must be installed
bash install-markdowntopdf.shThe installer will:
- Install Homebrew (if not present)
- Install pandoc, weasyprint, and duti via Homebrew
- Create
~/Applications/MarkdownToPDF.app - Set MarkdownToPDF as the default handler for
.md,.markdown, and.mdownfiles
If automatic file association fails, set manually:
- Right-click any
.mdfile in Finder - Select "Get Info"
- Under "Open with:", choose "MarkdownToPDF"
- Click "Change All..."
Double-click any .md, .markdown, or .mdown file. The PDF is created in the same directory and opens in Preview.
Remove the app manually. Remove customization and Homebrew packages only if they are no longer needed elsewhere:
rm -rf "$HOME/Applications/MarkdownToPDF.app"
rm -f "$HOME/Applications/.MarkdownToPDF.install.lock"
rm -rf "$HOME/Library/Application Support/MarkdownToPDF" # optional
brew uninstall weasyprint pandoc duti # optionalThe following behaviors are intentional:
- No uninstall command: Removal is straightforward enough to not warrant a dedicated uninstaller.
- Silent stderr on success: Successful conversions suppress warnings to avoid noisy output. Errors are shown in a dialog on failure.
- Hardcoded font sizes (8pt body, 7pt code): Dynamic sizing produced inconsistent results across documents.
- PDF overwrite without warning: The workflow prioritizes speed. The source
.mdfile is never modified.
Copy the default stylesheet to Application Support, then edit that copy:
mkdir -p "$HOME/Library/Application Support/MarkdownToPDF"
cp -n "$HOME/Applications/MarkdownToPDF.app/Contents/Resources/md2pdf.css" \
"$HOME/Library/Application Support/MarkdownToPDF/md2pdf.css"The external stylesheet overrides the bundled default and survives app reinstalls without invalidating the app signature. CSS url(...) resources are blocked; use declarations that do not load files or network resources.