Building MKVToolNix with Gui on a mac

Can anyone give build instructions to build MKVToolNix with gui on macos? The scripts in packaging seem to be able to build an .app on macos but I don’t get it working and there are no build instructions. It would be really nice if someone could give build instructions so that I can try building it on an arm-mac.

There’s no documentation apart from the scripts in packaging/macos. Basically:

  • install XCode
  • run XCode’s GUI at least once 'cause you must confirm the EULA or something like that; confirm with clang afterwards that you can run it from the CLI
  • the config for the main build script is packaging/macos/config.sh; you can override any of those settings with a an optional file packaging/macos/config.local.sh which is sourced after config.sh if it exists
  • run packaging/macos/build.sh; this should download all required sources & build the whole thing

The whole build process assumes that you have a developer SSL certificate from Apple for signing the binaries (this is done during the last step, when creating the DMG). That one can only be obtained by joining Apple’s developer program, which costs 99€/year here in Germany. If you’ve done that, you can use XCode to request official certificates. You’ll have to overwrite at least this setting in your config.local.sh as the default in config.sh is my own certificate’s ID, obviously. The certificates are stored in your login key chain.

Sources etc. are downloaded to ~/opt/…; building happens in ~/tmp/…

Thank you for the response. I was able to run the script build.sh successfully after creating the ~/opt folder and putting the xsl stylesheets and a source subfolder with the mkvtoolnix-92.0.tar.xz in it. After running the build script I got the mkvtoolnix directory in ~/tmp. Going to this directory and running rake and rake install created an app for me, but it is damaged and can’t be opened even with gatekeeper disabled. If I show the package contents of the app and run mkvtoolnix-gui from the terminal I get an error that an dylib is missing. Inside the app is no folder with dylibs like in your build. Also I’ve got an .app and not an dmg like you have explained. I wonder if this is related to code signing because I’ve used an self signed certificate and I don’t have an apple developer account. Is it possible to disable code signing? You should still be able to open an app without code signing, if gatekeeper is disabled?

Only running build.sh without arguments will indeed build MKVToolNix, but not the DMG. Building the DMG is done with an additional call to ./build.sh dmg. The code signing only happens during the DMG build, not earlier.

You can disable code signing by setting the variable SIGNATURE_IDENTITY empty. As said earlier, this is best done in a packaging/macos/config.local.sh, e.g. with unset SIGNATURE_IDENTITY.

One thing the DMG build does as well is to modify the executables & the dylibs so that their dylib requirements are all relative to the executable paths — that’s what makes the stuff in the DMG work on machines which don’t have your Qt installed, too.

To summarize:

  • create config.local.sh & unset SIGNATURE_IDENTIY
  • run build.sh once
  • run build.sh dmg once

That used to work at some point, but I really have no clue if it still does.

Oh yikes, those are good points. I can easily implement fixes for all three of those points.

I was able to successfully build MKVToolNix on an ARM based mac. Thank you.

1 Like