Gui app on Mac doesn't see my SQLite database, when launched by double-click on .app itself

  • Sorry for newbie questions, I'm not so familiar with deployment, but I don't know where to start.
    So, when Qt compiles and runs my app, everything works fine, but when I try to double click on app file/package from Debug (or Release) folder - app doesn't see database (won't write or show it's content). The difference is: Qt is launching not app itself, but executable from app package (
    I tried to investigate, but found only some thread from 2010 with broken doc link. Also, I see official info for "The Mac Deployment Tool", but in Qt in Build menu I see some separate "Run without deployment" option. Does it mean, that deployment automatically runs by default?
    Am I missing some step?

  • Qt Champions 2017


    The deployment tool is a command line tool that you run your self.
    ( at least on windows)

    I assume it will be the same on macOS

  • I'm just not sure I need deployment at this point, because I don't want to distribute my app. I just wanted it to launch by clicking on .app file.
    I think I figured it out by searching again at this forum and reading through some more (not-Mac related) topics.
    So, I fixed this by adding QCoreApplication::applicationDirPath() to the path of my database, so now it looks like this:


  • @Maxxii said in Gui app on Mac doesn't see my SQLite database, when launched by double-click on .app itself:


    be carefull because QCoreApplication::applicationDirPath() return the location inside the app bundle, if you place your database at the same level that it will doesnt work.

  • @cfdev
    Ok, thank you for advice.

  • Lifetime Qt Champion


    To add to @cfdev good point, you should use QStandardPaths to retrieve a proper folder to store your database.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.