Skip to content

Instantly share code, notes, and snippets.

@JySzE
Forked from dbrookman/build-mpv_silicon.sh
Last active May 24, 2024 03:43
Show Gist options
  • Save JySzE/d25c7b7abf1b689739d51a6a6a6e0e29 to your computer and use it in GitHub Desktop.
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.app on an Apple silicon 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. Install Xcode from this link or via the Apple App Store.

  3. Open Xcode and click Xcode at the top left corner > Settings > Locations > Command Line Tools.

  4. Even if there is something already listed there in Command Line Tools, Still click it as it will prompt you to type in your password.

  5. In terminal: xcode-select --install to be sure it all worked properly: "xcode-select: note: Command line tools are already installed."

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

  7. In terminal: brew install --build-from-source --only-dependencies mpv && brew install libplacebo && brew install molten-vk && brew install dylibbundler && brew install lua

  8. In terminal: git clone https://github.com/mpv-player/mpv

  9. In terminal: cd mpv

  10. In terminal: curl -s https://gist.githubusercontent.com/JySzE/d25c7b7abf1b689739d51a6a6a6e0e29/raw --output build-mpv_silicon.sh

  11. In terminal: sudo chmod 755 build-mpv_silicon.sh

  12. In terminal: sudo ./build-mpv_silicon.sh --static

  13. After your build is complete type cd build && cp -R mpv.app /Applications/mpv.app

  14. Now mpv is added to your applications list, Go ahead and manually open mpv once from spotlight search or from finder to get it to appear in the open with menu when you right click files. (Sometimes this isnt required)

  15. Next in terminal: sudo curl -s https://gist.githubusercontent.com/JySzE/34ee131da3974811a9469e1e3b7d4d34/raw --output ~/.config/mpv/mpv.conf

  • While sudo isnt required for curl normally I and a few others ran into a weird sonoma perm issue where it was needed to write directly to ~/.config/mpv/ so keep that in mind.
  1. Now go ahead and open up a video file with mpv and press the tilde key and it should tell you if a profile was loaded or not. If you see a profile loaded congrats you are now done.

I will not be providing ways to add lua scripts and other functionality to MacOS. You will need to figure that out on your own.

#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon Macs.
# Run this script from the root directory of the mpv repo.
# 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 [[ $1 == "--static" ]]; then
dylibbundler --bundle-deps --dest-dir build/mpv.app/Contents/MacOS/lib/ --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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment