Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to compile for linux and mac



  • Hi Guys,
    I'm using the Qt 5.10 and I want my application to run on the Linux and Mac and I can achieve this using Qt?.
    help me @jsulm , @SGaist


  • Lifetime Qt Champion

    @thippu Sure you can. For MacOS you will need a Mac machine. For Linux (I assume you're using Windows) the easiest way is to set up a virtual machine with Linux.


  • Moderators

    @thippu said in How to compile for linux and mac:

    help me @jsulm , @SGaist

    Please don't ask people directly like that. We're all busy. If somebody with the know to help you will see your post, they will reply, don't worry.

    I'm using the Qt 5.10 and I want my application to run on the Linux and Mac and I can achieve this using Qt?

    Qt code is cross platform. What you write will compile and run on any supported platform, including Linux and macOS.

    So all you need to do is:

    • write your app using Qt
    • compile it on Linux
    • compile it on macOS
    • done :-)

    If you want to distribute your app, then a bit more work is necessary:

    • use linuxdeployqt on Linux (or some other packaging tool)
    • use macdeployqt on macOS
    • ooor use Qt installer Framework if you prefer that approach


  • @sierdzio okay, Sorry for asking directly,
    Right now, I have 3rd party library linked to my project, e.g I want to use it for mac to this do I need to install the 3rd party lib to mac qt creator also?


  • Moderators

    @thippu said in How to compile for linux and mac:

    @sierdzio okay, Sorry for asking directly,
    Right now, I have 3rd party library linked to my project, e.g I want to use it for mac to this do I need to install the 3rd party lib to mac qt creator also?

    Depends on how you are including it, but in general yet, you need to have it installed on every platform. And you need to deploy it for every platform if you are distributing the application.

    Exactly how you deploy it will differ wildly based on multiple factors, so sadly there is no simple, easy answer here. Broadly speaking, your options are:

    • add library as dependency so system will automatically install it (that works on Linux if you distribute .deb or .rpm packages)
    • statically compile the library into your application (works on every platform, but you have to make sure you fulfill library's license, and you'll have to manually compile it for every platform)
    • bundle prebuilt library with your app (works on most platforms, but watch the license and you may need to)


  • Thank you @jsulm , @sierdzio , I will try to install.


Log in to reply