3

I am porting an application from Windows and Linux to macOS.

The application is written in Qt. It has a few dependent dylib (some built, some sdk). The exact same libraries and same Qt version are used for some other applications (which are not ready to be ported yet). It will not be distributed through the App Store.

The application can read, write, drag-and-drop, print custom type user files. It uses a sqlite3 database, provided - users should be able to browse to its location (since they should also have the ability to use a database from a different location). During print, it would be best to use the cups temporary folder to save temporary bitmap files.

I have tried to figure out the best way to install this type of app. Is the bundle packaging right for this type of app, or should I use the file system to place all required files in the most likely locations?

  1. Creating a bundle so far, I have the dependencies (including Qt frameworks) inside the Contents/Frameworks directory.

    • Where would I place the user created files... inside the bundle or inside the Users/MyCompany/MyProgram directory? I tried to save inside... can't browse inside the MyApp.app from inside the program.
    • Where would I place the sqlite3 database? If I place it inside the bundle (e.g. Contents/Resources), I cannot access it from inside the program.
    • Where would the entire bundle be installed? in /Applications/MyCompany/MyProduct is my guess?
  2. Without a bundle: from what I read, the following may be good locations:

    • For the executable: /Applications as above?
    • For the dependent libs: usr/share/MyCompany/MyProduct or /Library/MyCompany/MyProduct ?
    • User files obviously Users/MyCompany/MyProgram
    • Resource database ? I have no idea what a good place is, accessible to all users, where to keep such a file
    • This setup would allow other applications to be installed and use the same Qt framework and dependent dylibs... But I read something about apps not working if the dylibs are modified ?

Which is the best way and in that case, which are the best folder locations?

Should I assume that the installation is made with sudo rights? Can the installation be done without admin rights?

1

The application bundle should go in /Applications. This application bundle should contain everything. Libraries, dependencies, everything that the app needs to run, so that should the application bundle be copied to another machine's /Applications directory, it should be able to run.

Installing in /Applications requires admin. Should admin not be available, the standard location for a single user application is ~/Applications. This directory should not be expected to exist.

If something needs to be 'installed' on the system for the app, such as the aforementioned 'resource database', the app should prompt to install it in:

/Library/Application Support/developername/appname/

Should something need to be 'installed' for the current user, it should go in the same path prefixed with their home directory. This doesn't require admin.

~/Library/Application Support/developername/appname/

User files should not be saved in the root of the user's home directory. The user should have the opportunity to save files wherever they please, preferably with a standard OS X save dialog.

Also…

  • Cache files should go in:

    ~/Library/Caches/developername/appname/
    
  • The users preferences should go in:

    ~/Library/Preferences/com.bundleidentifier.plist
    

    If something more than a single property list needs to be saved…

    ~/Library/Preferences/developername/appname/
    
  • is there anything I have to do to install in /Applications ? Or is that the default place an app would get installed ? Would I use a package manager to specify the target location ? – Thalia Oct 29 '14 at 17:33
  • @Thalia The standard way a user installs an app in OS X is they download the .app bundle and use Finder to copy it to /Applications, then they open it to use it. – grg Oct 29 '14 at 17:35
  • In Windows and Linux, the application is using an .ini file to store user preferences (a lot more than windows positions and last save locations... preferences about tools inside the application as well). The .ini is a plain text with key-value pairs (not xml). Could I use the same file instead of a plist, and place it in ~/Library/Preferences/com.bundleidentifier.settings or something like that ? – Thalia Oct 29 '14 at 17:38
  • If users only get the app bundle... how will I provide the resources database ? – Thalia Oct 29 '14 at 17:40
  • @Thalia Technically, best practices say that it should be a .plist, but there's nothing stopping you using a text file or similar. If you really want to use a text file but also want to follow best practices, put your text file in a folder (in the preferences folder). Apps in OS X are expected to prepare themselves: detect a missing database and download the resource from an external server. – grg Oct 29 '14 at 18:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .