Skip to content

Instantly share code, notes, and snippets.

@JySzE
Forked from dbrookman/build-mpv_silicon.sh
Last active March 27, 2025 14:47
Show Gist options
  • Select an option

  • Save JySzE/d25c7b7abf1b689739d51a6a6a6e0e29 to your computer and use it in GitHub Desktop.

Select an option

Save JySzE/d25c7b7abf1b689739d51a6a6a6e0e29 to your computer and use it in GitHub Desktop.
How to build mpv.app on an Apple silicon Mac

Preparations

Before you can build mpv & mpv.app on an Apple silicon (M1 / M2) Mac, there's a couple of required dependencies you'll need to install if you haven't already:

  1. Go to System Preferences > Software Update. If there's anything there to update, do it.

  2. If you don't have the Xcode Command Line Tools installed, run xcode-select --install and select Install on the prompt that appears.

  3. If you don't have Homebrew installed, follow the instructions here.

  4. If you don't have pkg-config or meson installed, run brew install pkg-config meson.

  5. If you don't have all of mpv's dependencies installed, run brew install --only-dependencies mpv.

You'll also need a local copy of the mpv repo, which you can get by running git clone https://github.com/mpv-player/mpv.

You can now run the attached script to build mpv & mpv.app on an Apple silicon Mac yourself. Just make sure to run it from the root directory of the cloned repo.

Static Build

If you want to bundle a static build of mpv.app, perform these steps following the ones above.

  1. Run brew install dylibbundler.

  2. Run the script from the root directory of the cloned repo, but append --static to the command, like ./build-mpv_silicon.sh --static.


Updating

Going forward, you can update your local copy of the repo by running the following commands from its root directory:

git reset --hard
git clean --force -d -x
git pull origin master
#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon (M1 / M2) Macs.
# Run this script from the root directory of the mpv repo.
BUNDLE_STATIC=false
if [[ $1 == "--static" ]]; then
BUNDLE_STATIC=true
fi
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build
# test the binary we just built
./build/mpv --version
./TOOLS/osxbundle.py --skip-deps build/mpv
if $BUNDLE_STATIC; then
dylibbundler --bundle-deps --dest-dir ./build/mpv.app/Contents/lib/ --create-dir --install-path @executable_path/../lib/ --fix-file ./build/mpv.app/Contents/MacOS/mpv
# test the app binary to make sure all the dylibs made it okay
./build/mpv.app/Contents/MacOS/mpv --version
fi

Comments are disabled for this gist.