Skip to content

Instantly share code, notes, and snippets.

@mstuchida
Forked from dbrookman/build-mpv_silicon.sh
Created September 5, 2024 21:59
Show Gist options
  • Select an option

  • Save mstuchida/2aba21b2164a13fa3536399055e34a5a to your computer and use it in GitHub Desktop.

Select an option

Save mstuchida/2aba21b2164a13fa3536399055e34a5a to your computer and use it in GitHub Desktop.
How to build mpv & mpv.app on an Apple silicon Mac

Preparations

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

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

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

  3. If you've never run brew install --only-dependencies mpv, do so now.

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.app on an M1 Mac yourself. Just make sure you're in the root directory of the cloned repo before doing so so.


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
set -ex
# run this script from the root directory of the mpv repo
./bootstrap.py
LUAJIT_PKG_CONFIG_PATH="$(brew --prefix luajit-openresty)/lib/pkgconfig"
export PKG_CONFIG_PATH="$LUAJIT_PKG_CONFIG_PATH"
# if we only have ffmpeg@4, and not the latest ffmpeg, point to ffmpeg@4
if [[ -z "$(brew ls --versions ffmpeg)" && -n "$(brew ls --versions ffmpeg@4)" ]]; then
FFMPEG4_PKG_CONFIG_PATH="$(brew --prefix ffmpeg@4)/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$FFMPEG4_PKG_CONFIG_PATH"
# if we have neither version of ffmpeg, gtfo
elif [[ -z "$(brew ls --versions ffmpeg ffmpeg@4)" ]]; then
exit 1
fi
./waf configure --lua=luajit
./waf build
./TOOLS/osxbundle.py -s build/mpv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment