Here's how I installed pandoc
on my MacBook Pro (13–inch, M1, 2020) to run with Rosetta 2 — not natively, but on the x86_64
architecture — until a universal binary for macOS is built that supports the arm64
architecture in new Appple Silicon Macs.
This guide may be used to install other non-universal brew packages.
# Install Homebrew for x86_64 architecture
# https://soffes.blog/homebrew-on-apple-silicon
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install pandoc using that version of Homebrew
arch -x86_64 /usr/local/bin/brew install pandoc
Outputs
==> Downloading https://homebrew.bintray.com/bottles/pandoc-2.11.4.big_sur.bottle.tar.gz
Already downloaded: /Users/nono/Library/Caches/Homebrew/downloads/34e1528919e624583d70b1ef24381db17f730fc69e59144bf48abedc63656678--pandoc-2.11.4.big_sur.bottle.tar.gz
==> Pouring pandoc-2.11.4.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/pandoc/2.11.4: 10 files, 146.0MB
# Check pandoc's version
arch -x86_64 pandoc --version
Outputs
pandoc 2.11.4
Compiled with pandoc-types 1.22, texmath 0.12.1, skylighting 0.10.2,
citeproc 0.3.0.5, ipynb 0.1.0.1
User data directory: /Users/nono/.local/share/pandoc or /Users/nono/.pandoc
Copyright (C) 2006-2021 John MacFarlane. Web: https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.
arch -x86_64 pandoc sample.md -o sample.html
Contents of sample.md:
# Hello, Apple Silicon!
- Pandoc
- seems
- to
- work.
Contents of sample.html:
<h1 id="hello-apple-silicon">Hello, Apple Silicon!</h1>
<ul>
<li>Pandoc</li>
<li>seems</li>
<li>to</li>
<li>work.</li>
</ul>
While macOS
ships with Python 2 by default, you can install set Python 3 as the default Python version on your Mac.
First, you install Python 3 with Homebrew.
brew update && brew install python
To make this new version your default, you can add the following line to your ~/.zshrc
file (or ~/.bashrc
if you want to expose it in bash
instead of zsh
).
alias python=/usr/local/bin/python3
Then open a new Terminal and Python 3 should be running.
Let's verify this is true.
python --version # e.g. Python 3.8.5
python3
path?Homebrew provides info about any installed "bottle" via the info
command.
brew info python
# python@3.8: stable 3.8.5 (bottled)
# Interpreted, interactive, object-oriented programming language
# https://www.python.org/
# /usr/local/Cellar/python@3.8/3.8.5 (4,372 files, 67.7MB) *
# ...
And you can find the path we're looking for grep
.
brew info python | grep bin
# /usr/local/bin/python3
# /usr/local/opt/python@3.8/libexec/bin
You can also symlink python3
to python
.
ln -sf /usr/local/bin/python3 /usr/local/bin/python
In case your /usr/local/bin/python3
is also symlinked, you can check where it's symlinked to with:
readlink /usr/local/bin/python3
In my case, it returns ../Cellar/python@3.9/3.9.1_6/bin/python3
.
Your system's Python 2.7 is still there.
/usr/bin/python --version # e.g Python 2.7.16
You can also use Homebrew's Python 2.
brew install python@2