Compile OBS for Apple Silicon
Youtube Video
Prerequisites
- Xcode (not 100% sure this is needed but iirc, a dependency needed full Xcode)
- HomeBrew
- Template files
Step 1: Install dependencies and Download the project
Open terminal and download the dependencies
brew install akeru-inc/tap/xcnotary cmake cmocka ffmpeg jack mbedtls qt@5 swig vlc
Once done, clone the OBS project
git clone --recursive https://github.com/obsproject/obs-studio.git
Open the directory obs-studio
cd obs-studio
open .
Step 2: Modifications
In the root of the project directory, right click the CMakeLists.txt
file and open with Text Edit.
Find the line (you can use CMD + F) add_subdirectory(test)
and underneath the endif()
add the following line (before the else
):
add_subdirectory(cmake/helper_subdir)
Save the file and close Text Edit.
Now open the cmake directory, go to Modules and open “ObsHelpers.cmake” in Text Edit like before.
Find the line that says set(OBS_SCRIPT_PLUGIN_PATH "${OBS_INSTALL_PREFIX}${OBS_SCRIPT_PLUGIN_DESTINATION}")
after the endif()
add the following lines:
function(obs_finish_bundle)
if(NOT APPLE OR UNIX_STRUCTURE)
return()
endif()install(CODE
"if(DEFINED ENV{FIXUP_BUNDLE})
execute_process(COMMAND \"${CMAKE_SOURCE_DIR}/cmake/osxbundle/fixup_bundle.sh\" . bin WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\")
endif()")
endfunction()
Save and exit.
Now go back to the root obs-studio directory, open the plugins folder and open CMakeLists.txt in text edit. Then search for browser
and remove the following lines:
option(BUILD_BROWSER "Build browser plugin" ON)
if (BUILD_BROWSER)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/obs-browser/CMakeLists.txt")
add_subdirectory(obs-browser)
set(BROWSER_AVAILABLE_INTERNAL ON CACHE BOOL "Internal global cmake variable" FORCE)
else()
message(FATAL_ERROR "obs-browser submodule not found! Please fetch submodules or set BUILD_BROWSER=OFF.")
endif()
else()
set(BROWSER_AVAILABLE_INTERNAL OFF CACHE BOOL "Internal global cmake variable" FORCE)
endif()
Save and exit
Now go back to the root directory and open the cmake folder
Open the template files downloaded earlier, open the cmake folder. Select both the folders, then copy and paste them into the the cmake directory inside the obs project.
now go back to the root directory and open terminal, type cd
then drag and drop the cmake directory from the obs root directory into the terminal window. The press enter
Now run the following three commands:
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DDISABLE_PYTHON=ON ..//waitmake//waitcd rundir/RelWithDebInfo/bin
Once make has finished running and you ran that cd command, you can test obs works by running:
./obs
Once obs opens, press exit and then create a DMG by doing the following:
// change back to cmake
cd ../../..///make the dmgcpack
Once cpack has finished, by default the virtual camera was not added, you will need to manually add it. However, the dmg is read only.
Step 3: Adding the virtual cam
Convert the DMG into a writable one:
Type the following into terminal:
hdiutil convert -format UDRW -o ReadableAndWritableCopy.dmg
then drag and drop the obs DMG that was created.
Sample:
hdiutil convert -format UDRW -o ReadableAndWritableCopy.dmg obs-studio-x64-27.0.0-rc5-11-g6792e9c1c-modified.dmg
Once you have the DMG converted to writable, open the new DMG with:
open ReadableAndWritableCopy.dmg
Right click the OBS app and show package contents.
Navigate to Contents > Resources > Data
in another window, open the OBS project root directory, open cmake and copy the obs-mac-virtualcam plugin from rundir/RelWithxxx/data into the data directory in the DMG.
Now close the window and eject the dmg.
Once done, convert the DMG back to read only for shipping:
hdiutil convert -format UDRO -o OBS-ARM64-Final.dmg ReadableAndWritableCopy.dmg
That is all you need to do.