NOTE: Since March 2023, obs-studio
uses an updated build system on macOS that automated most steps required in old build systems. Build instructions for the legacy build system are retained in this document, albeit in a simplified form reflecting the suggested way macOS builds should be approached.
Clone the repository including submodules:
git clone --recursive https://github.com/obsproject/obs-studio.git
Check available CMake presets: cmake --list-presets
Select the macos
preset: cmake --preset macos
cmake --preset macos -DCMAKE_OSX_ARCHITECTURES=
x86_64
for Intel-Macs and arm64
for Apple Silicon-Macsarm64e
is not supported, as its not supported by macOS for anything but system frameworks
build_macos
)obs-studio
scheme from the scheme browser at the top of the Xcode window+
to build the project (or +
to build and run it).Alternatively the project can also be built on the command line:
build_macos
)xcodebuild
:xcodebuild \
-configuration \
-scheme obs-studio \
-parallelizeTargets \
-destination "generic/platform=macOS,name=Any Mac"
open UI//OBS.app
HINT: You can install the tool xcbeautify
to make the xcodebuild
output more readable - the suggested way to run the build command changes slightly in that case: set -o pipefail && 2>&1 | xcbeautify
CMake creates an install
scheme that will automatically install OBS into the Applications
directory. Choose this scheme from within Xcode (or specify via the command line) and build the project.
To generate optimised and fully codesigned application bundles, use the archive and export functions provided by Xcode:
Custom build options should be provided by a user preset file:
CMakeUserPresets.json
in the project root directory:{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 27,
"patch": 0
},
"configurePresets": [
{
"name": "custom-obs",
"displayName": "Custom macOS",
"description": "Custom macOS build",
"inherits": ["macos"],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"generator": "Xcode",
"binaryDir": "${sourceDir}/build_macos",
"cacheVariables": {
[...]
}
}
]
}
cacheVariables
object in the JSON filecmake --preset custom-obs
Any amount of custom presets can be set up this way including presets that inherit from other custom-presets.
HINT: If just a single variable should be overridden, cache variables can still be specified directly when invoking CMake, e.g. cmake --preset macos -DENABLE_BROWSER:BOOL=OFF
. This includes changing cache variables with the Terminal GUI tool ccmake
.
Starting with macOS 11, it is best practice to always codesign all binaries on macOS. For local execution an ad-hoc signature is sufficient, which Xcode will handle automatically ("Sign to Run Locally").
Because macOS stores application permissions (e.g., webcam access, microphone access, screen recording) based on code signatures, this has the side-effect of permissions not being applied to updated binaries (the underlying hashes will not match the entry in macOS' database).
The only way to fix this is to compile the application with a valid Apple developer certificate, as the code signature will not change between builds of the application and permissions will "stick".
Because obs-studio
is made up of multiple independent parts, signing is most easily configured via CMake: Specify a developer team ID via -DOBS_CODESIGN_TEAM
(you can find your team identifier in the Apple developer portal). This will enable automatic codesigning in Xcode for all targets built by the project.
When building (and packaging) on CI, a developer identity need to be provided instead via -DOBS_CODESIGN_IDENTITY
. An identity commonly takes a form of a string like Developer ID Application: ()
. This needs to match the name of the developer certificate that is installed on the machine.
To specify a provisioning profile (needed in future versions of obs-studio
with certain macOS features enabled), pass either the name or UUID of the provisioning profile to CMake via -DOBS_PROVISIONING_PROFILE
. If the provisioning profile is correctly installed in the system (usually by importing it via Xcode or copying it to ~/Library/MobileDevice/Provisioning\ Profiles
) Xcode will automatically pick it up. It will also be used for archiving and exporting.
NOTE: The following instructions only apply to the legacy build system superseded by the instructions above. They are retained here for the time being to allow building older versions of obs-studio
for now-unsupported versions of macOS.
Custom macOS builds allow full customization of the desired build configuration but also require manual setup and preparation. Available CMake configuration variables can be found in the CMake build system documentation.
xcode-select --install
in Terminal, orFFmpeg
, x264
, mbedTLS
, Qt
and more)~/development/obs-build-dependencies/obs-deps
git clone --recursive https://github.com/obsproject/obs-studio.git
(If you do not know what submodules are, or you are not using Git from the command line, PLEASE make sure to fetch the submodules too.)
CI/macos/01_install_dependencies.sh
from the checkout directory (run it with the --help
switch to see all available options). NOTE: The directory where the script will download and setup the dependencies in cannot be changed.
cmake -S . -B build -G Xcode \
-DCEF_ROOT_DIR="~/development/obs-build-dependencies/cef_binary_5060_macos_x86_64" \
-DCMAKE_PREFIX_PATH="~/development/obs-build-dependencies/obs-deps" \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_ARCHITECTURES="x86_64"
Optional Settings:
-DOBS_BUNDLE_CODESIGN_IDENTITY="[YOUR_IDENTITY]"
or a team using -DOBS_BUNDLE_CODESIGN_TEAM="[YOUR_TEAM_ID]"
-DCMAKE_INSTALL_PREFIX=[YOUR INSTALL DESTINATION]
.-G Ninja
or -G 'Unix Makefiles'
-DCMAKE_BUILD_TYPE=RelWithDebInfo
obs-studio.xcodeproj
from the build directory (or any other directory specified via the -B
switch above)obs
schema, recognisable by the OBS Studio app icon.
Installation will use the directory specified via -DCMAKE_INSTALL_PREFIX
or can be customised with the --prefix
switch for Ninja-based builds.
If using Xcode:
install
schemaIf using the command line (Xcode, Ninja, or GNU Makefiles):
cmake --build build
cmake --install build