Compiling mpv on Mac OS X

Note: This guide is outdated and won’t be updated anymore.

Hint: You can get ready to use builds here.

Introduction

958b8d1019b8cb77e5c9c37f0b26fb13

This is a guide to compiling mpv, a fork of the MPlayer family and the current recommended media player on *nix. It has more active development and some features like nicer CLI output, an On Screen GUI and high quality OpenGL video output.
This will ensure you are using the latest, most up-to-date high quality playback that you can get for OS X.
This guide is targeted at advanced users and assumes basic commandline-knowledge. This guide may not always be up to date, so you may have to do your own research. mpv on OS X requires at least 10.7.

Installation

  1. Only for <10.9:
  2. Install Homebrew by running the command
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    in a Terminal, install the Command Line Tools when asked.
  3. Install some other needed stuff: sudo easy_install docutils
  4. Build mpv and the needed dependencies using homebrew:
    The command lines you'll need are:

    • export LC_ALL=en_US.UTF-8 ; export LANG=en_US.UTF-8
    • brew install --HEAD --with-bundle --with-bluray-support --with-libdvdread --with-little-cms2 --with-lua --with-bundle mpv
  5. If you want to have an .app-bundle in ~/Applications: brew linkapps mpv
  6. Done!

Configuration

To set mpv as the default program to open .filetypes, get Finder-info on the filetype you want to associate, select mpv.app under Open with: and click the “Change All…” button. You can view options and keybinds here or by typing man mpv into Terminal. You can quit this dialogue any time by pressing q. mpv can also be launched by typing mpv into Terminal, dragging the file into the terminal window and hitting enter.

To make your own configuration, create the folders ~/.config/mpv and create the file mpv.conf in there. Paste the the options you want to change in that file (see mpv’s documentation for all possible options).

If you have sufficient GPU power, it is recommended to use the opengl-hq video-output (requires Intel HD4000 or better). To use this add this line to your config:
vo=opengl-hq:icc-profile-auto

Notes

  • Remember to keep everything up-to-date using brew update. Since mpv is on –HEAD, brew update won’t work for it. You need to uninstall and reinstall (brew rm mpv && brew install --HEAD --with-bundle --with-bluray-support --with-libdvdread --with-little-cms2 --with-lua --with-bundle mpv), as it’s a HEAD only formula homebrew is not smart enough to figure out the version it built.
  • Having MacPorts or Fink installed may break brew. See brew doctor if you run into problems.
  • If you have problems, join the #mpv channel on freenode or open an issue on the Github page. Please use the comments here only for problems related to CGi releases.

Original guide written by valtism. Modified.

155 Responses to Compiling mpv on Mac OS X

  1. suckoja writes:

    Thanks a lot for this short guide!
    I kept getting this error all the time

    error: possibly undefined macro: AC_PROG_LIBTOOL
    If this token and others are legitimate, please use m4_pattern_allow.
    See the Autoconf documentation.

    Figure out I have to update autoconf to get this done. Well the result is nice!

    For those who might need to update their GNU’s autotools to get thing done. Use this code here.
    sudo port install m4 autoconf automake libtool pkgconfig

  2. sky writes:

    Great guide! Thanks (will use it for other things 🙂

    My problem running sudo make install
    I get:

    make -C mplayer install
    Makefile:22: config.mak: No such file or directory
    make[1]: *** osdep/: Is a directory.  Stop.
    make: *** [install] Error 2

    Any ideas?
    Thanks

    • ChrisK writes:

      did compiling (make -j 6) go without errors? If it succeeded, the last line you see should be something like “CC mplayer” and you should have a mplayer binary in the mplayer folder.

  3. pigoz writes:

    I use my own scripts based on homebrew: https://github.com/pigoz/mplayerosx-builds
    Moreover I use only libass from the tarball (and not the git head) so I don’t have to install GNU’s autotools to make configure script.

  4. JonathanWestbrooke writes:

    I’d just like to say your guide was an excellent start for getting my feet wet in building from a git repo!
    Unfortunately I did receive the same error as “sky” and couldn’t complete the build, but after hours of googling and blind fiddling with the options/commands I was able to compile mplayer2, so I thought I’d provide a solution & update to this guide. (great guide ChrisK!)

    Firstly I was stuck where “sky” was, but that was the result of “make -j 6” compiling and ignoring an error or two:
    **************************************************
    Westbrooke:mplayer2-build MAC$ make
    script/libav-config
    yasm not found, use –disable-yasm for a crippled build

    Traceback (most recent call last):
    File “script/libav-config”, line 51, in
    main()
    File “script/libav-config”, line 49, in main
    check_call([executable] + args + extra_args)
    File “/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py”, line 488, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command ‘[‘/Users/MAC/mplayer2-build/libav/configure’, ‘–prefix=/Users/MAC/mplayer2-build/build_libs’, ‘–enable-gpl’, ‘–cpu=x86_64’, ‘–disable-debug’, ‘–enable-pthreads’, ‘–disable-shared’, ‘–enable-static’, ‘–enable-postproc’, ‘–disable-devices’, ‘–disable-vaapi’, ‘–disable-avconv’, ‘–disable-ffmpeg’, ‘–disable-avplay’, ‘–disable-avserver’, ‘–disable-avprobe’]’ returned non-zero exit status 1
    make: *** [libav-config] Error 1
    *********************************
    So i installed yasm with macports:
    “sudo port install yasm”
    and as you can see I modified the “configure” file located in “/mplayer2-build/libav/”
    and replaced ‘–cpu=host’ with ‘–cpu=x86_64’.
    While trouble shooting I became uncertain if it was picking this change up from libav_options, so this may/may not be necessary… nevertheless, it compiled this way

    then “export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/”
    and proceeded with “make” as apposed to “make -j 6” so it would halt on any errors

    then “sudo make install”

    and continue with the rest of the guide

    thanks ChrisK! big fan of coalgirls back in the day :)))

  5. Ichiro Ino writes:

    I’m getting this error…

    checking for FRIBIDI… no
    configure: error: Package requirements (fribidi >= 0.19.0) were not met:

    Requested ‘fribidi >= 0.19.0’ but version of FriBidi is 0.10.9

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.

    AFAIK, it can see fribidi but the version it found is not compatible.
    I went to MacPorts to see if there are any other builds but there’s none.
    http://www.macports.org/ports.php?by=name&substr=fribidi
    Am I missing something?

  6. Ichiro Ino writes:

    Disregard my earlier post, I get this instead:

    make -C libass install
    Making install in libass
    CC ass.lo
    CC ass_cache.lo
    CC ass_font.lo
    CC ass_fontconfig.lo
    CC ass_render.lo
    In file included from ass_font.c:35:
    ass_shaper.h:33: error: expected declaration specifiers or ‘…’ before ‘FriBidiParType’
    ass_shaper.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘resolve_base_direction’
    In file included from ass_render.c:26:
    ass_shaper.h:33: error: expected declaration specifiers or ‘…’ before ‘FriBidiParType’
    ass_shaper.h:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘resolve_base_direction’
    make[2]: *** [ass_font.lo] Error 1
    make[2]: *** Waiting for unfinished jobs….
    ass_render.c: In function ‘ass_render_event’:
    ass_render.c:1805: warning: implicit declaration of function ‘resolve_base_direction’
    ass_render.c:1805: error: too many arguments to function ‘ass_shaper_set_base_direction’
    make[2]: *** [ass_render.lo] Error 1
    make[1]: *** [install-recursive] Error 1
    make: *** [libass] Error 2
    make: *** Waiting for unfinished jobs….

  7. valtism writes:

    http://sites.google.com/site/hermihg/ is a quick way to get mplayer2 playback for OS X, but I’m not sure if that’s what this guide is about.

  8. duri writes:

    How can I get mplayer2 to start in the secondary screen by default (using the .mplayer/config file) ? (Lion 10.7.4)

  9. Clemens writes:

    Meanwhile, mplayer2 has gotten a port in MacPorts, so instead of compiling it “manually”, you can just run sudo port install mplayer2 now.

  10. valtism writes:

    I wrote you a simple guide to compiling mpv (a better fork than mplayer2) on OS X using Homebrew. This is much simpler and does not require so much crap to be installed on your system.

    1: Install Xcode from App Store
    2: Install Command Line Tools in Xcode -> Preferences -> Downloads
    3: Install Homebrew by pasting ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" into Terminal
    4: Register an account on GitHub.
    5: Create an authorise an SSH key with GitHub using this guide.
    6: Install pigoz’s homebrew mpv.
    brew tap mpv-player/mpv
    brew install --HEAD mpv
    7: Enter the password for your SSH key to begin the mpv install
    8: Done!

    To use mpv, simply type mpv into Terminal, drag the file into the Terminal window and hit enter.

    You can see more options and keybinds by typing man mpv into Terminal. You can quit this dialogue any time by pressing q.

    The mpv fork has a nice output setting that uses opengl, but with high quality settings that the normal opengl output misses. To use it, either use -vo opengl-hq on the commandline, or put “vo = opengl-hq” (without the quotation marks) in ~/.mpv/config

  11. prokrastinator writes:

    First of all, thanks for the great updated guide!

    But I’m always getting this error:

    ==> Installing mpv dependency: xvid
    ==> Downloading http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
    curl: (7) couldn’t connect to host
    Error: Download failed: http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz

    Someone able to solve this problem?
    I’m running this on a Macbook Pro with 10.6.8
    Thanks

    • ChrisK writes:

      Apparently the xvid website is down. Not much you can do about it.
      You should also consider updating your system.

  12. L`artiste writes:

    Since de xvid.org site is down, is there a way to download the tarball alone and provide it to the brew script ?

  13. valtism writes:

    A quick note: Since mpv is on –HEAD, brew update won’t work. You need to uninstall and reinstall (brew rm mpv && brew install --HEAD mpv), as it’s a HEAD only formula homebrew is not smart enough to figure out the version it built.

  14. BakaPhoenix writes:

    Hi! Thanks for the guide!
    How can i set the secondary screen as default?
    The command given for mplayer2 doesnt work vist mpv

  15. Asoksevil writes:

    Hello,

    I just downloaded the latest build of MPV from http://sva.wakku.to/~chris/mpv_builds/

    I open it but it just keeps crashing:

    [snip]
    OS Version: Mac OS X 10.7.5 (11G63b)
    [snip]
    Intel Core 2 Duo, 1.86 GHz, 4 GB, SMC 1.66f61
    [snip]

    How can I use MPV? They say that it’s better than VLC 2 but it’s just to hard to make it work.

    Thank you!

    • ChrisK writes:

      Read note 2 on the builds page. But we are working on making the builds compatible with older CPUs.
      Only way right now is to compile it yourself.

  16. Asoksevil writes:

    I see… since I got an Intel Core 2 Duo and Lion it won’t work…

    Thanks! I’m looking forward to that build which works on older version of Macs!

  17. MystPhysx writes:

    How do I remove MPV and all its dependencies?

  18. Miharin writes:

    Hey, I’ve been using MacPorts for all these kind of programs. Would you recommend uninstalling it now that I used Homebrew to get mpv? Will that also break everything that I installed with MacPorts? To make it more simple, which one is “better” and should be the only one installed?

  19. Peophin writes:

    I’m trying to compile this on 10.5.8 and I keep getting this error:

    warning: no debug symbols in executable (-arch i386)
    libtool: link: ( cd “.libs” && rm -f “output_dummy.la” && ln -s “../output_dummy.la” “output_dummy.la” )
    make[2]: *** [output_coreaudio_la-coreaudio.lo] Error 1
    make[1]: *** [install-recursive] Error 1
    make: *** [install-recursive] Error 1

    Any idea what I can do here?

  20. Mock Kernel writes:

    “> copying binary
    > generating Info.plist
    > bundling dependencies
    mpv.app/Contents/MacOS/lib/libquvi.7.dylib uses library /usr/local/lib/liblua.5.1.4.dylib which is not available anymore
    make: *** [osxbundle] Error 1”

    Yay.

  21. Link0306 writes:

    Hey, the app bundle does not seem to be working for me. I double click my .mkv file, mpv opens up in the dock, and then nothing, The video doesn’t play or anything.

  22. jagman1x3 writes:

    Trying to compile on 10.6.8 is giving me this:

    osdep/macosx_application.m: In function ‘cocoa_main’:
    osdep/macosx_application.m:326: error: stray ‘@’ in program
    osdep/macosx_application.m:326: error: ‘autoreleasepool’ undeclared (first use in this function)
    osdep/macosx_application.m:326: error: expected ‘;’ before ‘{‘ token
    make: *** [osdep/macosx_application.o] Error 1

    Not really sure what to do here…

  23. Idk What I'm Doing writes:

    Hello, so I got the mpv build to work! I was doing this for Eva 2.22 and the sound now works, so thanks! But how do I switch between english and japanese audio? The build only has window and movie tabs, nothing for audio or subtitles or anything.

  24. mike writes:

    i have problem with install mpv from homebreaw:`
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [flac] Error 1
    make[1]: *** [install-recursive] Error 1
    make: *** [install-recursive] Error 1

    how i make fix this problem.
    But if if compiling from source i give error to:
    make[1]: *** osdep/: Is a directory. Stop.

  25. Solaire writes:

    ==> Cloning https://github.com/mpv-player/mpv.git
    Updating /Library/Caches/Homebrew/mpv–git
    ==> Generating VERSION file from Homebrew’s git cache
    ==> ./configure –prefix=/usr/local/Cellar/mpv/HEAD –disable-sdl –cc=cc –disable-x11
    ==> make install
    – (BOOL)isEqual:(id)object;
    ^
    1 error generated.
    make: *** [video/out/cocoa/additions.o] Error 1
    make: *** Waiting for unfinished jobs….

    Any idea what to do with this?

  26. Mailia writes:

    If you want to have an app with the current version of the formula, you have to use brew install –HEAD mpv –with-bundle, since it doesn’t build the app by default. If you want to have a distributable bundle, use –with-dist-bundle instead.

  27. Julian Incko writes:

    Hi guys, maybe someone here can help me.

    I tried to compile mpv again, after my update to mavericks, but mpv just doesn’t want to play any files.

    So I downloaded the ready to use builds and… nothing, same problem.

    The app starts, but doesn’t play anything.

    I don’t know what causes all this, but I guess Mavericks is at fault?

    Did anyone manage to compile a functioning mpv since the public release of Mavericks?

  28. Pablo writes:

    I’m having the same problem after upgrading to Mavericks. I compiled MPV again, but it won’t show up anywhere. And Linkapps doesn’t work.

    I can’t find MPV, and it won’t show up in my system.

    See the screenshot I took: http://imgur.com/o3xjsgZ

  29. Julian Incko writes:

    So I tried everything and even did a clean install of Mavericks,

    Still I can’t manage to get mpv to work.

    Before Mavericks everything went perfectly according to your guide.

    What a bummer…

  30. Julian Incko writes:

    And yes I’ve the same problem as Pablo,

    There simply isn’t any app to begin with, although homebrew says the installation was a success.

  31. mpv-mavericks writes:

    Got mpv to recompile and install however the linkapps command is not working. It’s not showing up in /Applications (on the root of the hard drive) or ~/Applications (the one in my home directory)

    But if I open mpv via terminal and specify the location of the file it works perfectly.

    Any idea how to fix the linkapps issue?

  32. mpv-mavericks writes:

    I’m the same mpv-mavericks as above

    I created my own symlink to mpv in the /Applications folder but for some reason it would open terminal and give the output as to what to do with the executable. Whereas the previous install prior to Mavericks and this whole charade gave me the mpv menubar with the File options to quit and its various permutations and one or two other menubar items if I recall correctly.

    I seem to be at an impasse at this point. Any assistance or ideas from any of you folks would be great.

    Thanks for all the help so far.

  33. mpv-mavericks writes:

    ChrisK that was me who posted the ticket. Thanks for figuring out what pigoz changed. I look forward to the updated guide.

    Thanks for all your help.

  34. Pablo writes:

    Thank you for the help Chris.

    Works like a charm now.

    I really like the new version of MPV. Updated icons and finally a GUI navbar in the player.

    Couldn’t have done this without your help and easy to understand guide.

  35. mpv-mavericks writes:

    ChrisK

    Thanks so much! mpv works great again!

  36. Matthias Heinz writes:

    Alright, so I did everything in the installation guide, but when I try to open any file with it, I hear the audio, but there is no video playing. I don’t get any errors or anything.

    Do you have any idea how to fix this issue?

  37. Sai writes:

    I wanted to point out that updated command line to install homebrew is:

    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"

  38. Ky writes:

    Hi ChrisK, just wanted to point out that updating does not work anymore, I am getting errors on installing the waf part, kindly update the guide if there are any changes to the formula. thanks!

  39. squidbear writes:

    A couple option flags seem to have been changed. Here’s the updated install command: brew install --HEAD --with-bundle --with-libdvdread --with-libbluray --with-libquvi --with-little-cms2 --with-lua mpv

  40. Ky writes:

    it still does not work, still getting the “rst2man” error, i think pigoz know it as this was on the latest commit:

    Revert “mpv: use homebrew DSL for docutils dependency” …
    Seems like it doesn’t add rst2man to the path. Fail.

    but im still getting error with the rst2man.

  41. Ky writes:

    Hi ChrisK, already done that. this is what i am getting on the last part.

    ==> Installing mpv
    ==> Cloning https://github.com/mpv-player/mpv.git
    Cloning into ‘/Library/Caches/Homebrew/mpv–git’…
    remote: Counting objects: 575, done.
    remote: Compressing objects: 100% (566/566), done.
    remote: Total 575 (delta 51), reused 280 (delta 1)
    Receiving objects: 100% (575/575), 2.65 MiB | 457.00 KiB/s, done.
    Resolving deltas: 100% (51/51), done.
    Checking connectivity… done
    ==> Generating VERSION file from Homebrew’s git cache
    ==> waf configure –prefix=/usr/local/Cellar/mpv/HEAD –disable-sdl –disable-x1
    ==> waf install
    Waf: Leaving directory `/private/tmp/mpv-v9oB/build’
    Build failed
    -> task in ‘rst2man’ failed (exit status 1):
    {task 4348284816: rst2man mpv.rst -> mpv.1}
    ‘ /usr/local/bin/rst2man.py ../DOCS/man/en/mpv.rst DOCS/man/en/mpv.1 ‘

    READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
    If reporting this issue please do so at (not mxcl/homebrew):
    https://github.com/mpv/homebrew-player/issues

    thanks!

  42. mushi writes:

    I also keep getting the error as Ky despite having the docutils 0.11.

    Build failed
    -> task in ‘rst2man’ failed (exit status 1):
    {task 4302809488: rst2man mpv.rst -> mpv.1}
    ‘ /usr/local/bin/rst2man.py ../DOCS/man/en/mpv.rst DOCS/man/en/mpv.1 ‘

  43. Pablo writes:

    Same problem here.

    ==> Installing mpv
    ==> Cloning https://github.com/mpv-player/mpv.git
    Cloning into ‘/Library/Caches/Homebrew/mpv–git’…
    remote: Counting objects: 578, done.
    remote: Compressing objects: 100% (569/569), done.
    remote: Total 578 (delta 55), reused 188 (delta 1)
    Receiving objects: 100% (578/578), 2.65 MiB | 204.00 KiB/s, done.
    Resolving deltas: 100% (55/55), done.
    Checking connectivity… done
    ==> Generating VERSION file from Homebrew’s git cache
    ==> waf configure –prefix=/usr/local/Cellar/mpv/HEAD –disable-sdl –disable-x1
    ==> waf install
    Waf: Leaving directory `/private/tmp/mpv-GY3y/build’
    Build failed
    -> task in ‘rst2man’ failed (exit status 1):
    {task 4353993488: rst2man mpv.rst -> mpv.1}
    ‘ /usr/local/bin/rst2man.py ../DOCS/man/en/mpv.rst DOCS/man/en/mpv.1 ‘

    Btw. using Step 3 won’t install the latest version of docutils. Use pip instead to get the latest version.

  44. Pablo writes:

    Could this help?

    “We’ve seen that shelling out to rst2man.py can be problematic.

    In the “ideal” case (installing from a completely brand new python env or a new virtualenv) everything works.

    The issue is some distro packages will rename the executable scripts provided by a package (sometimes rst2man or rst2man-2.7.py for example). docutils specifies this script as rst2man.py which is what you get if you use pip to install everything. The problem is that even if you pip install awscli if you install this into the system site-packages, pip will notice that docutils is already installed (for example via “sudo apt-get install python-docutils” or via the distro’s package manager) and skip it.

    If pip says docutils is installed then import docutils will work, but both the location of the rst2man.py script as well as what it’s named can vary. This example may not even be on the PATH by default (homebrew puts things in /usr/local/share/python for example).

    The code for rst2man is simple enough that we can directly use the code via docutils rather than piping to rst2man.”

  45. Akkarin writes:

    I’m having the same problem.

    Build failed
    -> task in ‘rst2man’ failed (exit status 1):
    {task 4363902032: rst2man mpv.rst -> mpv.1}
    ‘ /usr/local/bin/rst2man.py ../DOCS/man/en/mpv.rst DOCS/man/en/mpv.1 ‘

  46. ripzdawg writes:

    For those still having problems with building the latest version try adding the following lines to your .bash_profile:

    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8

    Change en_US to whatever your locale is.

  47. steenuil writes:

    I followed all the steps in this guide and yet when it’s done compiling everything I end up with no video output.
    mpv -vo help returns this:
    Available video outputs:
    null : Null video output
    image : Write video frames to image files

  48. steenuil writes:

    Well, this is the configure log.
    When checking for video outputs it says that neither cocoa nor opengl were found. As I said, I followed this guide but compiled the ffmpeg –HEAD version with a few options.
    Trying to use the default version of ffmpeg, recompiling, reinstalling homebrew or Xcode doesn’t help. I’m on OS X 10.7.5. Did I fuck something up in the process up updating from 10.6.8?
    Wat do?

  49. steenuil writes:

    Doesn’t work. The configure script finds cocoa now but there’s an error while compiling, here’s the build log.

  50. pigoz writes:

    @steenuil try now, it should be fixed.