Building QtWebKit on OS X

Konstantin Tokarev edited this page Feb 7, 2018 · 13 revisions

Building QtWebKit on OS X


The best way to install all needed software is via Homebrew

You need to install:

  • XCode -
  • XCode Command Line Tools - (after you installed XCode) xcode-select --install
  • CMake
  • Qt 5 (minimum supported version is 5.2)
  • libpng
  • libjpeg or libjpeg-turbo

Quick installation of some dependencies

# For buildng with Qt >= 5.10
brew install libpng libjpeg-turbo cmake
# For building with Qt < 5.10
brew install libpng libjpeg cmake

Optional tools

  • ninja - significantly increases the compilation speed.
brew install ninja


Mono.framework presence on build machine is known to deceive CMake into using its headers for libraries like libpng and sqlite. It leads to crashes when using built QtWebKit. Please remove it before proceeding to the next step.

UPD Maybe setting CMAKE_FIND_FRAMEWORK to LAST can help


If you don't have qmake in your $PATH, you must provide the path to it via -DQt5_DIR:

./Tools/Scripts/build-webkit --qt --cmakeargs="-Wno-dev -DQt5_DIR=<path_to_your_Qt_installation>/lib/cmake/Qt5"

In case of Qt >= 5.10 you may also need to help cmake with finding libjpeg-turbo. Following cmake arguments should be used:


For example, if you have Qt 5.10 installed in $HOME/Qt, then the command will be:

./Tools/Scripts/build-webkit --qt --cmakeargs="-Wno-dev -DQt5_DIR=$HOME/Qt/5.10/clang_64/lib/cmake/Qt5 -DCMAKE_PREFIX_PATH=/usr/local/opt/jpeg-turbo"

Then you need to install resulting binaries. If your build was using ninja, run

ninja -C WebKitBuild/Release install


make -C WebKitBuild/Release install

QtWebKit will be installed into your Qt directory, side by side with other Qt modules, and will be available for building your projects.


  • Application crashes on macOS in WebCore::PNGImageDecoder::decode on setjmp call

PNG headers don't match used library, see section Warning above.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.