Important: Please read the Qt Code of Conduct -

Qt cannot load cocoa plugin

  • Hi, I'm trying to compile and run an application on a MacBook using Qt Creator. There are no issues compiling the project, but when I try and run it, it seems to be unable to load a plugin.

    Could not load the Qt platform plugin "cocoa" in "" even though it was found.
    The application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

    This error occurs both when trying to run the application from Qt Creator or via Finder. It seems to only happen when I use the CMake build system (no issues when using QMake), but my existing project that I need to deploy on MacOS uses CMake.

    My steps to reproduce are:

    • Install a completely clean MacOS (no user data)
    • Install CMake 3.15
    • Install Qt 5.13.1 MacOS package
    • Open QtCreator->New Project->Qt Quick Application - Scroll
    • Set build system to CMake (important)
    • Compile and notice error

    I am using:
    Qt 5.13.1
    macOS Catalina 10.15
    Apple Clang 11

    I recognize that for final user deployment I will need to use the macqtdeploy tool to copy the Qt libraries to the executable folder, but I should be able to run my app from QtCreator without doing this? Especially as it works fine when using QMake.