This is an howto to compile VLC media player on Mac OS X, focused on VLC 2.0 and newer.
- 1 Pre-requisites
- 2 Get the source code
- 3 Build VLC with a single command
- 4 Build steps
- 4.1 Additional development tools
- 4.2 SDK selection
- 4.3 Prepare 3rd party libraries
- 4.4 Bootstrap VLC
- 4.5 Configure the VLC build
- 4.6 Build VLC
- 4.7 Package VLC Application for Mac
- 4.8 Sign VLC Application for Mac
- 5 What's wrong: troubleshooting
- You need at least MacOSX 10.7, Lion or later is strongly recommended, though.
- Developer Tools from Apple from http://developer.apple.com/technology/xcode.html
You need at least Xcode4.3.
Note: If using Xcode 4.3, the command line tools must be installed manually through preferences.
Xcode select on Xcode 4.3
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.
If this outputs 'Error: No developer directory...', then use xcode-select to select the developer directory within the Xcode package.
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
Configure the environment
On Mac OS X 10.7 VLC needs to be compiled using Apple's clang 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):
export CC="xcrun clang" export CXX="xcrun clang++" export OBJC="xcrun clang"
If you are using a C-Shell, you need to use the setenv command of course.
git clone git://git.videolan.org/vlc.git
Build VLC with a single command
Setup a build folder:
cd vlc && mkdir build && cd build
And run the build:
Wait and you are finished
You can see more options for this build (change arch or sdk):
Now, if you prefer, you can read the following detailed information on how the build internally works:
Additional development tools
You need development tools, notably all the autotools, to build VLC correctly.
Here is how:
cd vlc/extras/tools ./bootstrap && make cd ../..
Important: set the new PATH.
Set the OSX_Version to your current OSX Version
Prepare 3rd party libraries
Before compiling VLC, you need lots of other libraries. Here is how to get them:
cd contrib mkdir -p osx && cd osx ../bootstrap --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
Prebuilt libraries (recommended)
If you want to download a prebuilt package of all the needed libraries.
And then skip to bootstrap section of this page.
Build your own libraries (not for the faint-hearted)
If you want to build from source a package in the contribs:
make -j4 .gettext export PATH=$PWD/../x86_64-apple-darwin10/bin:$PATH
If you had no errors, the 3rd party libraries (contrib) are built correctly and you can proceed to the next step.
Go back to the VLC source directory:
This will create the configure script:
Configure the VLC build
Create a build folder:
mkdir -p build && cd build
To list the different options of configure:
To build a binary with the previously installed x86_64-apple-darwin10 contrib:
../extras/package/macosx/configure.sh --enable-debug --host=x86_64-apple-darwin10 --build=x86_64-apple-darwin10
Package VLC Application for Mac
If you want to share the application with another user or another computer:
If you want a disk-image:
make package-macosx-plugin for the Safari/Mozilla plugin.
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"
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.
What's wrong: troubleshooting
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:
usr, Headers, Private, SDKs, Tools, Makefiles
You can easily create these links by executing the following command for each folder (whereas theFolder is one of these six):
ln -s /full/path/to/Developer/theFolder /Developer/theFolder
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.
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
QTsound compilation on X.5
MacOS X.5.SDK is broken - 2 options exist:
- 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/
- Edit /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/QTKit.framework/Headers/QTKit.h and add the
#import <QTKit/QTCaptureDecompressedAudioOutput.h> where needed.
- Configure the VLC build to explicitly use the MacOS10.6.sdk by adding the following flag:
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!
Be sure to:
- 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).
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:
cd /usr/libexec/as sudo mkdir ppc cd ppc sudo ln -sf /Xcode3/usr/bin/as as