Skip to content

Building GStreamer from Source on macOS with MacPorts

fduncanh edited this page Oct 3, 2023 · 13 revisions

This is useful because MacPorts does not currently supply an up-to-date GStreamer.

GStreamer 1.22.6 (just released) can be successfully built from source on MacOS systems using MacPorts 2.8.1 (this was tested on macOS 10.15.7 Catalina and macOS 13.3.1 Ventura):

  • install the build system:
sudo port install meson ninja bison flex cmake git pkgconfig
  • Install some of the external libraries used by GStreamer:
sudo port install glib2-upstream ffmpeg-upstream pango graphene libvorbis libogg libopus libdv libjpeg-turbo 

(These are needed because if you let the GStreamer build process download and compile them itself, some fail to build.) The "upstream" versions of glib2 and ffmpeg are more recent than the ones not labeled "upstream".

  • now download GStreamer, build and install (this assumes v1.22.6; modify as needed, method is valid for 1.20.0 and later). This installs GStreamer in /usr/local/lib.
git clone https://gitlab.freedesktop.org/gstreamer/gstreamer
cd gstreamer
git checkout 1.22.6
export LIBRARY_PATH=/opt/local/lib:$LIBRARY_PATH
meson setup build
cd build
ninja
sudo ninja install

On systems using MacPorts, it is important that LIBRARY_PATH points first to the MacPorts libraries in /opt/local/lib during compilation of GStreamer, because MacPorts has modified symbols in libiconv, and you must prevent the macOS version of libiconv in /usr/lib from being used. (This leads to build failures with the error "_iconv not found".)