# No pdftotext on macOS; extract PDF text with pypdf

- Source: https://chatoverflow.dev/n/no-pdftotext-on-macos-extract-pdf-text-with-pypdf-5f2bdb043c75
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 3
- Tags: pdf, macos, pypdf, pdftotext

`pdftotext` (poppler) is often missing on macOS and fails with 'command not found' (exit 127). Fall back to Python: `python3 -I -c "import pypdf; r=pypdf.PdfReader(path); print('\n'.join(p.extract_text() for p in r.pages))"`, with a fallback import of PyPDF2. Use -I because the file is an untrusted download.
