ffmpegmacosdeveloper-tools

How to Install FFmpeg on Mac (Homebrew and Static Build)

·Javid Jamae·10 min read
How to Install FFmpeg on Mac (Homebrew and Static Build)

You need FFmpeg on your Mac, and every guide says brew install ffmpeg. Then Homebrew stops to ask for Xcode Command Line Tools, or the install finishes and your shell still answers zsh: command not found: ffmpeg. Both take about two minutes to fix once you know which one you're hitting.

Quick answer: To install FFmpeg on Mac, install Xcode Command Line Tools with xcode-select --install, install Homebrew, then run brew install ffmpeg. Verify with ffmpeg -version. If the command isn't found, add Homebrew to your PATH: Apple Silicon Macs install to /opt/homebrew/bin, Intel Macs to /usr/local/bin.

The Homebrew path: brew install ffmpeg in three steps

Homebrew is the fastest route because it ships a prebuilt binary bottle. You aren't compiling FFmpeg, you're downloading it plus its shared libraries.

1. Install Xcode Command Line Tools

Homebrew needs the Command Line Tools for git, curl, and the system compiler. Without them, the Homebrew installer will trigger the Apple installer dialog mid-run and appear to hang.

xcode-select --install
xcode-select -p

The second command should print /Library/Developer/CommandLineTools. You do not need the full Xcode app, which is about 15 GB. The Command Line Tools package is a fraction of that.

2. Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

At the end, the installer prints two "Next steps" commands for your shell profile. Run them. Skipping that line is the single most common cause of command not found later.

3. Install FFmpeg

brew install ffmpeg
ffmpeg -version

On a clean machine with a decent connection this takes a few minutes, mostly spent downloading dependency bottles. Then prove the encoder actually works without hunting for a test file:

ffmpeg -f lavfi -i testsrc=size=640x480:rate=30 -t 5 \
  -c:v libx264 -pix_fmt yuv420p test.mp4

If that writes a five second MP4, your install is real.

What brew install ffmpeg actually pulls in

brew install ffmpeg installs a prebuilt bottle that already includes libx264, libx265, libvpx, libaom, dav1d, SVT-AV1, LAME, Opus, and libass, so you don't need to compile anything or add codec flags. Run brew deps ffmpeg | wc -l and you'll see the tree is north of 70 packages. Budget roughly a gigabyte of disk once everything lands.

Two things it does not include:

  • libfdk_aac. Homebrew's default formula excludes it because the Fraunhofer license is non-free. Use brew tap homebrew-ffmpeg/ffmpeg and brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac if you need it. That path builds from source and can take 20+ minutes.
  • **Old-style --with-* options.** Homebrew dropped formula options in 2019. Any tutorial telling you to run brew install ffmpeg --with-libvpx is stale.

To see exactly what your build was configured with:

ffmpeg -buildconf
ffmpeg -hide_banner -encoders | grep -E "libx264|libx265|videotoolbox"

That last one matters on a Mac. h264_videotoolbox and hevc_videotoolbox give you hardware encoding through Apple's media engine, which is dramatically faster than libx264 on an M-series chip at the cost of some quality per bit.

Install FFmpeg on macOS without Homebrew (static build)

A static build is one self-contained binary with the codecs compiled in. No package manager, no dependency tree, roughly 80 MB on disk instead of a gigabyte. This is the right choice if you're on a locked-down work machine or you just don't want Homebrew.

Grab a macOS build from a source linked on ffmpeg.org/download.html. evermeet.cx publishes x86_64 builds that run on Apple Silicon through Rosetta 2. OSXExperts.net and martin-riedl.de publish native arm64 builds. Check the architecture on the download page before you grab one.

mkdir -p ~/bin
mv ~/Downloads/ffmpeg ~/bin/ffmpeg
chmod +x ~/bin/ffmpeg
xattr -dr com.apple.quarantine ~/bin/ffmpeg
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

That xattr line is the one people miss. macOS Gatekeeper quarantines anything downloaded from a browser, and the binary will die with a "cannot be opened because the developer cannot be verified" dialog until you strip the attribute.

If you took the Intel build on an M-series Mac, install Rosetta first:

softwareupdate --install-rosetta --agree-to-license

MacPorts is the third option: sudo port install ffmpeg. It compiles more from source, so expect a longer install than Homebrew.

Verify PATH on Apple Silicon (/opt/homebrew vs /usr/local)

This is where Apple Silicon trips people, and it's the same confusion showing up in every forum thread on the topic. Default macOS PATH includes /usr/local/bin but not /opt/homebrew/bin. So a Homebrew install on an M-series Mac is invisible to your shell until Homebrew's shellenv line is in your profile.

which -a ffmpeg
file $(which ffmpeg)
echo $PATH

which -a lists every match, not just the winner. If you migrated from an Intel Mac you may have two: an old x86_64 build in /usr/local/bin and the new arm64 one in /opt/homebrew/bin. Because /usr/local/bin comes first in the default PATH, the old one wins, and you get mystifying slow encodes or missing-codec errors. file tells you which architecture you're actually running:

/opt/homebrew/bin/ffmpeg: Mach-O 64-bit executable arm64

Fix the ordering by putting Homebrew's shellenv at the end of your zsh profile:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
source ~/.zprofile

Then delete the stale copy: sudo rm /usr/local/bin/ffmpeg, or uninstall the Intel Homebrew under Rosetta if you have one.

When brew breaks: the update, upgrade, reinstall sequence

The classic Mac FFmpeg failure isn't the install, it's the day after an unrelated brew upgrade. A shared library version bumps, FFmpeg's binary still points at the old dylib, and you get this:

dyld[41823]: Library not loaded: /opt/homebrew/opt/x265/lib/libx265.209.dylib
  Reason: tried: '/opt/homebrew/opt/x265/lib/libx265.209.dylib' (no such file)
zsh: abort      ffmpeg -i input.mp4 out.mp4

Work the sequence in this order and stop when it works:

brew update                      # refresh formulae first, always
brew upgrade ffmpeg              # pick up a rebuilt bottle
brew reinstall ffmpeg            # relink against current dylibs
brew link --overwrite ffmpeg     # fix symlink collisions in bin/
brew doctor                      # report broken links and stray files
brew cleanup                     # reclaim old versions

brew reinstall ffmpeg fixes the dyld error above about nine times out of ten. If it doesn't, the nuclear option is brew uninstall --ignore-dependencies ffmpeg && brew install ffmpeg.

Common pitfalls

  • Running brew with sudo. Never do it. It changes ownership on /opt/homebrew and every later command complains. Recover with sudo chown -R $(whoami) /opt/homebrew.
  • Assuming a corrupt file is a broken install. Invalid data found when processing input or moov atom not found means the input file is truncated, not that FFmpeg is misinstalled. Check the file with ffprobe first. See ffprobe: How to Inspect Video Metadata Before Processing.
  • Forgetting -pix_fmt yuv420p. FFmpeg will happily produce a yuv444p H.264 file that QuickTime and Safari refuse to play. Add the flag for anything headed to a browser or a phone.
  • Copying a tutorial's -vf chain that needs a filter you don't have. No such filter: 'ocr' means the formula was built without tesseract support. ffmpeg -filters tells you what you actually have.
  • Editing ~/.zshrc when you needed ~/.zprofile. Login shells read .zprofile, interactive shells read .zshrc. Homebrew's own instructions use .zprofile for a reason.

Homebrew, static build, or neither

Setup timeDiskUpdatesShips with your code
Homebrew3-10 min~1 GB with deps`brew upgrade ffmpeg`No
Static buildUnder 1 min~80 MBManual re-downloadNo
MacPorts15+ min~1 GB with deps`sudo port upgrade ffmpeg`No
Hosted APINoneNoneManagedYes

Your Mac isn't production

Conventional wisdom: once ffmpeg -version prints, you're done. That's true right up to the moment the code leaves your laptop, and most setups produce exactly that outcome. But the problem isn't your install, it's that FFmpeg on a Mac is a machine-local dependency with a ~1 GB dependency tree and an architecture attached to it.

The -c:v h264_videotoolbox command that flies on your M3 doesn't exist on a Linux container. The 80 MB static binary blows past the 50 MB unzipped AWS Lambda deployment limit before you've written a line of application code, which is why FFmpeg on AWS Lambda turns into a layer-size problem. Vercel and Cloudflare Workers won't run a binary at all. And a four-minute encode that's fine in your terminal is a hard timeout in a serverless function.

So you end up maintaining two paths: the Mac one you debugged today, and a container or a worker somewhere else that has to produce byte-identical output. That second path is where the real cost lives, and it's worth pricing before you build it. We broke the math down in FFmpeg in the cloud vs running FFmpeg yourself.

Keep Homebrew's FFmpeg for what it's genuinely good at: figuring out the right filter chain, checking a file, testing a preset on your desk. When that command needs to run a thousand times against user uploads, hand it to an API instead of packaging a binary. FFmpeg Micro takes the same operations you just tested locally, transcoding, captions, watermarks, composition, audio extraction, as one API call with no servers to run and no binary to ship. It works from code, from n8n, Make, and Zapier, and from AI agents over MCP.

FAQ

How do I install FFmpeg on Mac without Homebrew?

Download a static macOS build from a source listed on ffmpeg.org/download.html, move the binary into ~/bin, run chmod +x and xattr -dr com.apple.quarantine on it, then add ~/bin to your PATH. It's one self-contained file of roughly 80 MB with no dependency tree.

Why does ffmpeg say "command not found" after brew install?

Your shell PATH doesn't include Homebrew's bin directory. On Apple Silicon that's /opt/homebrew/bin, which macOS does not add by default. Run echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile and open a new terminal.

Does brew install ffmpeg include libfdk_aac?

No. Homebrew's default ffmpeg formula excludes libfdk_aac because of its non-free license. Use the homebrew-ffmpeg/ffmpeg tap with --with-fdk-aac to build a version that includes it, or use the native aac encoder, which is good enough for nearly all web and social delivery.

How do I update FFmpeg on my Mac?

Run brew update to refresh the formulae, then brew upgrade ffmpeg. If you hit a dyld "Library not loaded" error afterward, brew reinstall ffmpeg relinks it against the current dylibs.

How do I uninstall FFmpeg on macOS?

Run brew uninstall ffmpeg, then brew autoremove to drop the dependencies nothing else needs. For a static build, delete the binary and remove the PATH line from your shell profile.

Try the operations you just installed locally without writing any glue code in the playground, then check the request format in the docs. Sign up free and the first jobs are on the free tier.

About Javid Jamae

Founder & CEO at FFmpeg Micro

Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.

Software EngineeringVideo ProcessingFFmpegCloud ArchitectureAPI DesignAutomation

Ready to process videos at scale?

Start using FFmpeg Micro's simple API today. No infrastructure required.

Get Started Free