|
OpenShot Library | libopenshot 1.1.1
|
These instructions describe how to build libopenshot (and its dependency libopenshot-audio) from source on a modern macOS system, producing a working libopenshot.dylib and Python 3 bindings (_openshot.so, openshot.py) that can be imported by openshot-qt.
They have been verified on macOS 15 and macOS 27 (Apple Silicon, arm64) with AppleClang 17 and 21 and CMake 4.0.3. The same steps apply to Intel Macs; the only difference is that Homebrew lives at /usr/local on Intel and at /opt/homebrew on Apple Silicon. Every path used below is derived via brew --prefix, so the commands are architecture-neutral.
arm64) and Intel (x86_64) paths.Install Xcode's Command Line Tools (this is enough, the full Xcode IDE is not required):
Install Homebrew from https://brew.sh if you do not already have it. After installation, confirm that brew is on your PATH:
The following libraries and tools are required. All of them are available as Homebrew formulae.
cmake (build system)swig (generates the Python bindings)qt@5 or qt (Qt 6). Both are supported; CMake auto-detects the version via -DUSE_QT6=AUTO (the default). Qt formulae are keg-only, so they must be referenced via CMAKE_PREFIX_PATH.ffmpeg@7 (the version used by this recipe; newer FFmpeg compatibility is being validated separately)libopenshot-audio (built from source, see below)libomp (OpenMP runtime for AppleClang, which does not ship OpenMP out of the box)pkgconf (used by FFmpeg detection)Optional but recommended for a more complete build:
imagemagick (adds extra image decode/encode paths)resvg or librsvg (SVG rendering)babl (colorspace conversions used by some effects)catch2 (required only to build and run the unit tests)qt@5, ffmpeg@7, and libomp are keg-only on Homebrew and are therefore not symlinked into the default prefix. That is expected, and the cmake commands below locate them explicitly.
libopenshot and libopenshot-audio are separate repositories. Clone them as siblings of each other:
The build commands below assume both repositories sit in the same parent directory.
libopenshot-audio provides the audio engine, based on JUCE. libopenshot will not configure without it.
A successful build produces build/libopenshot-audio.<version>.dylib and build/src/openshot-audio-demo. You do not need to run cmake --install build; the next step points libopenshot directly at the build/ directory via OpenShotAudio_ROOT.
From the sibling libopenshot directory:
Notes on the arguments above:
CMAKE_PREFIX_PATH tells CMake where to find Qt and FFmpeg, both of which are keg-only in Homebrew. CMake auto-detects Qt 5 vs Qt 6 by default (-DUSE_QT6=AUTO).OpenShotAudio_ROOT points at the uninstalled libopenshot-audio build tree.OpenMP_* flags are required because AppleClang does not ship with OpenMP; they tell CMake to use the Homebrew libomp via the -Xpreprocessor -fopenmp idiom.ENABLE_RUBY=0 is required today. Apple's system Ruby headers in /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework still declare APIs with the register storage-class specifier, which C++17 has removed, so attempting to build the Ruby bindings fails with ‘ISO C++17 does not allow 'register’ storage class specifier`. The Python bindings are unaffected.A successful build produces:
build/src/libopenshot.<version>.dylibbuild/bindings/python/_openshot.sobuild/bindings/python/openshot.pybuild/src/examples/openshot-example, openshot-html-example, openshot-playerBefore touching your system Python, confirm the Python bindings import directly from the build tree:
This should print the libopenshot version (for example, 1.0.1). If it does, the build is healthy.
To install into Homebrew's prefix so that openshot-qt can find the bindings without manual PYTHONPATH tweaks:
The default CMAKE_INSTALL_PREFIX comes from CMake, which on macOS is /usr/local regardless of the host architecture. You can override it to match your Homebrew prefix:
Unit tests require Catch2. CMake disables tests when Catch2 is not found.
AGL was removed from the macOS SDK in macOS 10.14 (Mojave, 2018). The stale link directive was removed from libopenshot-audio in version 1.0.1; if you see this error, update to libopenshot-audio 1.0.1 or the latest develop branch.
AppleClang does not ship an OpenMP runtime. Install libomp and pass the five OpenMP_* hint flags shown in the build command above.
Apple's system Ruby headers have not yet been updated for C++17. Pass -DENABLE_RUBY=0 to disable the Ruby bindings. Python bindings are not affected.
libopenshot's CMake cannot find libopenshot-audio. Either build it as described above and pass -DOpenShotAudio_ROOT=/path/to/libopenshot-audio/build, or install it into a directory listed in CMAKE_PREFIX_PATH.
This recipe was verified with FFmpeg 7. Use the versioned ffmpeg@7 formula and the explicit prefix above to avoid accidentally selecting a newer Homebrew FFmpeg while its compatibility is being validated.
Once libopenshot builds and import openshot works, the graphical editor openshot-qt can be run against this build. See https://github.com/OpenShot/openshot-qt for the Qt/Python frontend.
To contribute patches, please read https://github.com/OpenShot/openshot-qt/wiki/Become-a-Developer.