Difference between revisions of "MacOSCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
(remove $ in command lines to allow copy/pasting)
 
(81 intermediate revisions by 9 users not shown)
Line 1: Line 1:
This is an '''howto''' to compile {{VLC}} on ''Mac OS X'', focused on '''VLC 2.0''' and newer.  
+
{{Lowercase}}
 +
This is an '''howto''' to compile {{VLC}} on '''macOS''' ''(formerly known as Mac OS X)'', focused on '''VLC 3.0''' and later.  
  
 
= Pre-requisites  =
 
= Pre-requisites  =
Line 5: Line 6:
 
=== Apple Software ===
 
=== Apple Software ===
  
*You need at least MacOSX 10.5. '''10.6''', '''Snow Leopard''' or later is strongly recommended, though.
+
Those are the minimum build system requirements to compile VLC 4.0 (current development version). They are also highly recommended to compile VLC 3.0:
*'''Developer Tools from Apple''' from http://developer.apple.com/technology/xcode.html<br> Both ''Xcode3'' and ''Xcode4'' should be fine. <br />Note: If using [https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/WhatsNewXcode/Articles/xcode_4_3.html Xcode 4.3] or later, the command line tools must be installed manually through preferences. Additionally, [https://trac.videolan.org/vlc/ticket/6305 Xcode 4.3 will require changes to VLC's build system] which are currently pending and may require patching until resolved.
+
* At least '''macOS 10.13.4''', or any later version
 +
* At least '''Xcode 9.3''' from [https://developer.apple.com/xcode/ developer.apple.com/xcode]. (Note: Installing the developer tools package is not needed, and building with that package is not supported)
 +
* Use at least '''macOS SDK 10.13''' (this is included and the default in Xcode 9.3)
 +
* Install python3 (macOS pkg installer from python.org)
 +
* Java 8 JDK (needed to compile Java menu support for blurays)
  
=== Xcode select on Xcode 4.3 ===
+
==== Compiler test ====
  
If you are on Xcode 4.3 with no previous Xcode installation , you probably need to run xcode select to point to your xcode developer directory.
+
Ensure the compiler is found correctly by running
  
 
  xcrun clang
 
  xcrun clang
  
If this outputs 'Error: No developer directory...', then use xcode-select to select the developer directory within the Xcode package.
+
in the Terminal, if this outputs anything else than <code>clang: error: no input files</code>, see the troubleshooting part of this document.
  
something like:
+
==== Developer directory test ====
 
 
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer 
 
 
 
=== Git  ===
 
 
 
If you have XCode 4, Git is already installed
 
You just need to point your Terminal to it:
 
 
 
export PATH=/Developer/usr/bin:$PATH
 
 
 
If you have Xcode 3, [http://git-scm.com/ get Git from their website].
 
  
=== Configure the environment ===
+
The Xcode developer directory must be used, not the command line tools developer directory, as only Xcode includes all necessary tools.
  
On '''Mac OS X 10.6''' VLC needs to be compiled using Apple's llvm-gcc-4.2 compiler in its latest version. To use this compiler, you need to export the respective variables. In a Bourne Shell, type this (if Xcode is installed to its default location; bash is the default shell on OS X):  
+
Run the following command in Terminal:
  
  export CC=/Developer/usr/bin/llvm-gcc-4.2
+
  xcode-select --print-path
export CXX=/Developer/usr/bin/llvm-g++-4.2
 
export OBJC=/Developer/usr/bin/llvm-gcc-4.2
 
  
On '''Mac OSX 10.8.2''' use the following
+
It needs to print out the path to your Xcode installation, like this
  
  export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
+
  /Applications/Xcode.app/Contents/Developer
export CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
 
export OBJC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
 
  
If you are using a C-Shell, you need to use the setenv command of course.
+
If it prints out a path to the command line tools package, select the correct path using the xcode-select tool. See [https://wiki.videolan.org/OSXCompile/#Xcode_.27No_developer_directory.27_error here] for the correct command.
  
 
= [[GetTheSource|Get the source code]]  =
 
= [[GetTheSource|Get the source code]]  =
  
  git clone git://git.videolan.org/vlc.git
+
git clone git://git.videolan.org/vlc.git
  
 
= Build VLC with a single command  =
 
= Build VLC with a single command  =
 +
This is the most simple way to build VLC, including all its necessary dependencies. This way is highly recommended to use, as it sets up everything automatically.
  
 
Setup a build folder:
 
Setup a build folder:
Line 55: Line 46:
  
 
And run the build:
 
And run the build:
  ../extras/package/macosx/build.sh
+
  ../extras/package/macosx/build.sh -c
 +
 
 +
The command line switch -c rebuilds all dependencies (contribs) from source. If you want to use a prebuild contrib package, omit the -c option.
  
Wait and you are finished
+
Wait and you have finished.
  
You can see more options for this build (change arch or sdk):
+
You can see more options for this script (change arch or sdk):
 
  ../extras/package/macosx/build.sh -h
 
  ../extras/package/macosx/build.sh -h
  
= Build steps =
+
In case this fails, please try the step-by-step build guide below using a
Now, if you prefer, you can read the following detailed information on how the build internally works:
+
clean checkout.
  
== Additional development tools  ==
+
== Making changes and compile again ==
  
You need development tools, notably all the autotools, to build VLC correctly.
+
Using build.sh is the recommended way to do a fresh VLC build. Now, if you did some changes to the VLC source code, you can try to compile the change by calling build.sh again. But sometimes this is a bit cubersome, as it might take longer, and sometimes its preferred to execute some build commands directly.
 
Here is how:
 
cd vlc/extras/tools
 
./bootstrap && make
 
cd ../..
 
  
'''Important''': set the new PATH.
+
For that reason, a script called env.build.sh is included in VLC (starting with VLC 4.0 in vlc.git), which helps you setting the correct environment of your Terminal. The correct environment is needed, to make sure the right internal tools are used for the build process.
export PATH=$PWD/extras/tools/build/bin:$PATH
 
  
== SDK selection and 32/64 bits  ==
+
Before you compile again with make, just source this script into the current Terminal (pay attention to the dot at the front of the command):
 +
. ../extras/package/macosx/env.build.sh
  
=== SDK selection ===
+
You can also create a symlink to that script in a more convenient location, for instance into the main vlc checkout directory:
 +
# change directory to root git checkout
 +
ln -s $PWD/extras/package/macosx/env.build.sh
 +
cd build # go back to your build directory
 +
. ../env.build.sh
  
If you want to use the 10.6 SDK (your VLC will only run on 10.6 and more recent computers):
+
Afterwards, in the same terminal, you can recompile by using the usual commands like make:
 +
make
 +
./bin/vlc-osx-static -vv # To test compiled changes
  
export OSX_VERSION=10.6
+
= Build steps =
 +
Now, if you prefer, you can read the following detailed information on how the build internally works. This section describes all steps which are internally done in build.sh already. Likely, they are only relevant to you if you do not want to use build.sh and env.build.sh.
  
You can do the same for '''10.5''', but please check that you have ''MacOSX10.5.sdk'' installed in ''/Developer/SDKs/'' . If you are using Xcode 4.2, you can [http://stackoverflow.com/a/6293605 install the 10.5 sdk] with the .dmg from Xcode3.
+
== Additional development tools  ==
  
=== 32/64bits selection ===
+
You need a number of tools, notably all the autotools, to build VLC correctly.
 +
VLC has a way to build the specific versions of these tools required from source, here is how:
 +
 +
cd extras/tools
 +
  ./bootstrap && make
 +
cd ../..
  
The instructions below will build a 64 bits binary using 10.6 (Snow Leopard) SDK. This is reflected by using host and build variables '''x86_64-apple-darwin10'''.
+
'''Important''': Add the extras/tools build results to your PATH, before doing anything else:
 +
export PATH=$PWD/extras/tools/build/bin:$PATH
  
This "triplet" is ARCHITECTURE-apple-SYSTEM.
+
== Prepare [[Contrib Status|3rd party libraries]]  ==
  
'''ARCHITECTURE'''
+
To compile VLC, you need lots of other libraries, called 3rd party. VLC has the so-called “contribs” system to help building these libraries
 +
from source. Alternatively you can use a pre-built package of these libraries provided by VideoLAN.
  
*<code>x86_64</code> represents Intel 64bits.
+
<!--
*<code>i686</code> represents Intel 32bits.
+
FIXME: Add guide how to use pre-built nightly contribs:
*<code>powerpc</code> represents PowerPC 32bits.
 
  
'''SDK SYSTEM'''
+
=== Using pre-built nightly contribs ===
 +
Together with the nightly builds, the build bot does each night a new build of all of the 3rd party libraries required for VLC.
 +
(Not all contribs are included in this pre-built package, as not all contribs are enabled on all OSes and required.)
 +
-->
  
*<code>darwin9</code> represents MacOSX 10.5.
+
First, set the correct '''SDK''' version for the 3rd party libraries, usually your current OS X Version:
*<code>darwin10</code> represents MacOSX 10.6.
 
  
So to make a PowerPC build, you would use '''powerpc-apple-darwin9'''. So to make a intel32 build for 10.5+, you would use '''i686-apple-darwin9'''. So to make a intel64 build for 10.6+, you would use '''x86_64-apple-darwin10'''.
+
export OSX_VERSION=10.11
  
== Prepare [[Contrib Status|3rd party libraries]]  ==
+
Then, prepare the 3rd party library folder:
  
Before compiling VLC, you need lots of other libraries. Here is how to get them:
+
  mkdir -p contrib/contrib-osx &amp;&amp; cd contrib/contrib-osx
 
+
  ../bootstrap --build=x86_64-apple-darwin15
cd contrib
 
  mkdir -p osx &amp;&amp; cd osx
 
  ../bootstrap --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
 
  
 
=== Prebuilt libraries (recommended) ===
 
=== Prebuilt libraries (recommended) ===
Line 120: Line 120:
 
  make prebuilt
 
  make prebuilt
  
And then skip to [[OSXCompile#Bootstrap_VLC|bootstrap section of this page]].
+
Now you can just skip to the [[OSXCompile#Update_PATH|Update PATH]] section.
  
 
=== Build your own libraries (not for the faint-hearted) ===
 
=== Build your own libraries (not for the faint-hearted) ===
 +
You need to install the [http://www.oracle.com/technetwork/pt/java/javase/downloads/index.html Java JDK], to support java code for libbluray.
  
If you want to build from source a package in the contribs:  
+
If you want to build contribs from source, you first need to make gettext, which is needed for some other contrib libraries to build:  
  
 
  make -j4 .gettext
 
  make -j4 .gettext
export PATH=$PWD/../x86_64-apple-darwin10/bin:$PATH
 
  
Then:  
+
Now you need to update your path for the gettext tools to be usable later on, see the [[#Update_PATH|Update PATH]] section above.
 +
 
 +
Then fetch contrib sources:  
 +
 
 +
make fetch
  
  make -j4
+
and build them with:
 +
 
 +
  make
  
 
If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.
 
If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.
  
=== Go Back ===
+
=== Update PATH ===
  
Go back to the VLC source directory:  
+
First we go back to the source directory:
  
 
  cd ../..
 
  cd ../..
 +
 +
And now we still need to add the contribs to our path, so they can be found:
 +
 +
export PATH=$PWD/contrib/x86_64-apple-darwin15/bin:$PATH
  
 
== Bootstrap VLC  ==
 
== Bootstrap VLC  ==
Line 146: Line 156:
  
 
  ./bootstrap
 
  ./bootstrap
 +
 +
Check that there are no obvious errors at this stage, like missing gettext or an error at exit.
  
 
== Configure the VLC build  ==
 
== Configure the VLC build  ==
Line 157: Line 169:
 
  ../extras/package/macosx/configure.sh --help
 
  ../extras/package/macosx/configure.sh --help
  
To build a 64 bits binary:  
+
To build a binary with the previously installed x86_64-apple-darwin15 contrib:  
  
  ../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
+
  ../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin15
 +
 
 +
By default it will not use the installed SDK, like Xcode does, but use System Root. This means that if you built contribs on your own, the configure script might behave unexpectedly, for example enabling functions which are not present in a given operating system version. To work around this and build against the latest installed SDK, you can use:
 +
 
 +
--with-macosx-sdk=`xcrun --show-sdk-path`
 +
 
 +
If you want to use a different SDK, you can list all installed SDKs with <code>xcodebuild -showsdks</code> and to get the path for it, you can use the following command <code>xcodebuild -version <SDK Flag from before> Path</code>.<br />
 +
For example: <code>xcodebuild -version -sdk macosx10.11 Path</code>
  
 
== Build VLC  ==
 
== Build VLC  ==
Line 168: Line 187:
 
and wait...
 
and wait...
  
== Package VLC Application for Mac ==
+
== Run VLC  ==
 +
After <code>make</code>, you can just run VLC like so:
  
If you want to share the application with another user or another computer:
+
./bin/vlc-osx-static
  
 +
If you want a VLC app bundle, just do
 +
 
  make VLC.app
 
  make VLC.app
 +
 +
And use it like a normal .app bundle.
 +
 +
== Package VLC Application for Mac  ==
  
 
If you want a disk-image:  
 
If you want a disk-image:  
Line 178: Line 204:
 
  make package-macosx
 
  make package-macosx
  
Respectively <code>make package-macosx-plugin</code> for the Safari/Mozilla plugin.
+
Note: If you want a more fancy disk image, you need the [https://bitbucket.org/al45tair/dmgbuild dmgbuild] tool, which can be installed using <code>pip install dmgbuild</code> if you have
 +
python installed using [https://brew.sh Homebrew].
  
 
== Sign VLC Application for Mac  ==
 
== Sign VLC Application for Mac  ==
Line 186: Line 213:
 
  extras/package/macosx/codesign.sh -i "certificate name"
 
  extras/package/macosx/codesign.sh -i "certificate name"
  
If you want to support OS X Snow Leopard and Leopard with your signature, you need to enable the "-g" option. Note that you need to replace the signature leaf hash "75GAHG3SZQ" with your own inside the codesign script prior to doing so, since otherwise your certificate will mix with VideoLAN's and your binary will be rejected by the OS.
+
= Troubleshooting =
 
 
= What's wrong: troubleshooting =
 
 
 
=== Xcode path  ===
 
 
 
Starting with Leopard, Xcode may be installed to a custom location on the administrator's choice. While this is non-problematic for ordinary Xcode projects, VLC needs a little help. You have to place extra symbolic links in /Developer pointing to your custom location for these folders:
 
 
 
<code>usr, Headers, Private, SDKs, Tools, Makefiles</code>
 
 
 
You can easily create these links by executing the following command for each folder (whereas theFolder is one of these six):
 
  
<code>ln -s /full/path/to/Developer/theFolder /Developer/theFolder</code>
+
== 3rd party packagers and PATH  ==
  
=== Xcode version  ===
+
'''Pay careful attention to remove any reference to 3rd party package managers from your environment.''' This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.  
 
 
Please make sure that you are using the latest Xcode3 or the latest version of Xcode4 to compile VLC
 
 
 
=== 3rd party packagers and PATH  ===
 
 
 
'''Pay careful attention to remove any reference to 3rd party package managersfrom your environment.''' This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.  
 
  
 
It shouldn't be necessary, but it can happen.  
 
It shouldn't be necessary, but it can happen.  
Line 216: Line 227:
 
  export PATH=$PWD/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
 
  export PATH=$PWD/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
  
=== QTsound compilation on X.5  ===
+
== Xcode 'No developer directory' error ==
 +
When running <code>xcrun clang</code>, if you see
  
MacOS X.5.SDK is broken - 2 options exist:
+
Error: No developer directory...
  
Option 1:
+
then use xcode-select to select the developer directory within the Xcode package, to point to your xcode developer directory.
  
*Download the MacOS10.6.sdk and get QTCaptureDecompressedAudioOutput.h from ''/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/QTKit.framework/Headers/'' and move it to ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/''
+
something like:
  
*Edit ''/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/QTKit.h'' and add the
+
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer  
 
 
#import &lt;QTKit/QTCaptureDecompressedAudioOutput.h&gt; where needed.
 
 
 
Option 2:
 
 
 
*Configure the VLC build to explicitly use the MacOS10.6.sdk by adding the following flag:
 
  --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk
 
 
 
=== Cross-Compilation to PPC from X.6 intel ===
 
If you want to compile VLC for PPC, based on a X.6 intel, you need to tweak a few things since Apple broke it.
 
 
 
'''This is VERY advanced stuff!'''
 
  
==== Pre-requisites ====
+
== Xcode tooling tries to use SDK in CommandLineTools directory ==
Be sure to:
+
Occasionally it has been reported that Xcode tooling tries to compile with an SDK located under the .../Developer/CommandLineTools directory, even if Xcode.app is properly installed and a suitable SDK is available inside the app.
* have X.6.8
 
* Xcode 4.2 installed in the normal ''/Developers'' location
 
* Xcode 3 installed in ''/Xcode3'' location
 
* MacOS X.6 and X.5 SDK installed in ''/Developers/SDKs/'' , as explained above (SDK selection).
 
  
==== GNU AS ====
+
This problem might become visible with a similar error like this:
Using this out of the box will not work because '''AS''' for ppc is broken on the default setup. Here is how to fix it:
+
  error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
  cd /usr/libexec/as
 
sudo mkdir ppc
 
cd ppc
 
sudo ln -sf /Xcode3/usr/bin/as as
 
  
 +
The root cause of this issue is now known yet and likely lies inside the apple provided tooling. One known workaround is to delete or move away the CommandLineTools directory.
  
[[Category:Building]] [[Category:Coding]]
+
[[Category:Building]]
 +
[[Category:macOS]]

Latest revision as of 19:20, 17 June 2020

This is an howto to compile VLC media player on macOS (formerly known as Mac OS X), focused on VLC 3.0 and later.

Pre-requisites

Apple Software

Those are the minimum build system requirements to compile VLC 4.0 (current development version). They are also highly recommended to compile VLC 3.0:

  • At least macOS 10.13.4, or any later version
  • At least Xcode 9.3 from developer.apple.com/xcode. (Note: Installing the developer tools package is not needed, and building with that package is not supported)
  • Use at least macOS SDK 10.13 (this is included and the default in Xcode 9.3)
  • Install python3 (macOS pkg installer from python.org)
  • Java 8 JDK (needed to compile Java menu support for blurays)

Compiler test

Ensure the compiler is found correctly by running

xcrun clang

in the Terminal, if this outputs anything else than clang: error: no input files, see the troubleshooting part of this document.

Developer directory test

The Xcode developer directory must be used, not the command line tools developer directory, as only Xcode includes all necessary tools.

Run the following command in Terminal:

xcode-select --print-path

It needs to print out the path to your Xcode installation, like this

/Applications/Xcode.app/Contents/Developer

If it prints out a path to the command line tools package, select the correct path using the xcode-select tool. See here for the correct command.

Get the source code

git clone git://git.videolan.org/vlc.git

Build VLC with a single command

This is the most simple way to build VLC, including all its necessary dependencies. This way is highly recommended to use, as it sets up everything automatically.

Setup a build folder:

cd vlc && mkdir build && cd build

And run the build:

../extras/package/macosx/build.sh -c

The command line switch -c rebuilds all dependencies (contribs) from source. If you want to use a prebuild contrib package, omit the -c option.

Wait and you have finished.

You can see more options for this script (change arch or sdk):

../extras/package/macosx/build.sh -h

In case this fails, please try the step-by-step build guide below using a clean checkout.

Making changes and compile again

Using build.sh is the recommended way to do a fresh VLC build. Now, if you did some changes to the VLC source code, you can try to compile the change by calling build.sh again. But sometimes this is a bit cubersome, as it might take longer, and sometimes its preferred to execute some build commands directly.

For that reason, a script called env.build.sh is included in VLC (starting with VLC 4.0 in vlc.git), which helps you setting the correct environment of your Terminal. The correct environment is needed, to make sure the right internal tools are used for the build process.

Before you compile again with make, just source this script into the current Terminal (pay attention to the dot at the front of the command):

. ../extras/package/macosx/env.build.sh

You can also create a symlink to that script in a more convenient location, for instance into the main vlc checkout directory:

# change directory to root git checkout
ln -s $PWD/extras/package/macosx/env.build.sh
cd build # go back to your build directory
. ../env.build.sh

Afterwards, in the same terminal, you can recompile by using the usual commands like make:

make
./bin/vlc-osx-static -vv # To test compiled changes

Build steps

Now, if you prefer, you can read the following detailed information on how the build internally works. This section describes all steps which are internally done in build.sh already. Likely, they are only relevant to you if you do not want to use build.sh and env.build.sh.

Additional development tools

You need a number of tools, notably all the autotools, to build VLC correctly. VLC has a way to build the specific versions of these tools required from source, here is how:

cd extras/tools
./bootstrap && make
cd ../..

Important: Add the extras/tools build results to your PATH, before doing anything else:

export PATH=$PWD/extras/tools/build/bin:$PATH

Prepare 3rd party libraries

To compile VLC, you need lots of other libraries, called 3rd party. VLC has the so-called “contribs” system to help building these libraries from source. Alternatively you can use a pre-built package of these libraries provided by VideoLAN.


First, set the correct SDK version for the 3rd party libraries, usually your current OS X Version:

export OSX_VERSION=10.11

Then, prepare the 3rd party library folder:

mkdir -p contrib/contrib-osx && cd contrib/contrib-osx
../bootstrap --build=x86_64-apple-darwin15

Prebuilt libraries (recommended)

If you want to download a prebuilt package of all the needed libraries.

make prebuilt

Now you can just skip to the Update PATH section.

Build your own libraries (not for the faint-hearted)

You need to install the Java JDK, to support java code for libbluray.

If you want to build contribs from source, you first need to make gettext, which is needed for some other contrib libraries to build:

make -j4 .gettext

Now you need to update your path for the gettext tools to be usable later on, see the Update PATH section above.

Then fetch contrib sources:

make fetch

and build them with:

make

If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.

Update PATH

First we go back to the source directory:

cd ../..

And now we still need to add the contribs to our path, so they can be found:

export PATH=$PWD/contrib/x86_64-apple-darwin15/bin:$PATH

Bootstrap VLC

This will create the configure script:

./bootstrap

Check that there are no obvious errors at this stage, like missing gettext or an error at exit.

Configure the VLC build

Create a build folder:

mkdir -p build && cd build

To list the different options of configure:

../extras/package/macosx/configure.sh --help

To build a binary with the previously installed x86_64-apple-darwin15 contrib:

../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin15

By default it will not use the installed SDK, like Xcode does, but use System Root. This means that if you built contribs on your own, the configure script might behave unexpectedly, for example enabling functions which are not present in a given operating system version. To work around this and build against the latest installed SDK, you can use:

--with-macosx-sdk=`xcrun --show-sdk-path`

If you want to use a different SDK, you can list all installed SDKs with xcodebuild -showsdks and to get the path for it, you can use the following command xcodebuild -version <SDK Flag from before> Path.
For example: xcodebuild -version -sdk macosx10.11 Path

Build VLC

Just do:

make -j4

and wait...

Run VLC

After make, you can just run VLC like so:

./bin/vlc-osx-static

If you want a VLC app bundle, just do

make VLC.app

And use it like a normal .app bundle.

Package VLC Application for Mac

If you want a disk-image:

make package-macosx

Note: If you want a more fancy disk image, you need the dmgbuild tool, which can be installed using pip install dmgbuild if you have python installed using Homebrew.

Sign VLC Application for Mac

If you want to sign your application with a certificate, for example for Gatekeeper, you need to run:

extras/package/macosx/codesign.sh -i "certificate name"

Troubleshooting

3rd party packagers and PATH

Pay careful attention to remove any reference to 3rd party package managers from your environment. This is important to avoid conflicts between your package manager (homebrew, fink, macports...) and the contrib package manager we use to build our contrib.

It shouldn't be necessary, but it can happen.

git must still be accessible though!

unset PKG_CONFIG_PATH
unset PKG_CONFIG_LIBDIR
export PATH=$PWD/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

Xcode 'No developer directory' error

When running xcrun clang, if you see

Error: No developer directory...

then use xcode-select to select the developer directory within the Xcode package, to point to your xcode developer directory.

something like:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer  

Xcode tooling tries to use SDK in CommandLineTools directory

Occasionally it has been reported that Xcode tooling tries to compile with an SDK located under the .../Developer/CommandLineTools directory, even if Xcode.app is properly installed and a suitable SDK is available inside the app.

This problem might become visible with a similar error like this:

error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.

The root cause of this issue is now known yet and likely lies inside the apple provided tooling. One known workaround is to delete or move away the CommandLineTools directory.