Polite location to store application data shared between users

Hi there,

I have a plugin that stores a license file for authorization and I would like the license file to be accessible to all users of the computer once one user has performed the authorization.

The two logical places I see to put the license file are /Library/Application Support and /Users/Shared.

As a user, I'm not a huge fan of applications filling up the Shared folder but if it means the application doesn't have to elevate privileges to write into the Application Support folder then I'm all for it.

Looking in my Shared folder I see a couple of applications that have started their own Library folder - eg. /Users/Shared/Library/Application Support/<name of application>/Licenses and /Users/Shared/<name of application>/Library.

Is there a standard/expected way for an application to store shared data in the Shared folder? Should I be making my own Library folder as well?!

Thank you for your help and useful opinions.

I think /Library is a better option here.

You wrote:

if it means the application doesn't have to elevate privileges to write into the [/Library/Application Support] folder

Privilege escalation is a feature, not a bug, IMO. Most Macs have a single user. For those Macs that have multiple users, many of them are deploying in managed environments: a Mac where the parents ‘manage’ the kids, a school lab full of Macs, and so on. If you use /Users/Shared, you run the risk of a managed user messing up your app’s state for other managed users.

Having said that, privilege escalation is a pain. For a summary of the issues, see BSD Privilege Escalation on macOS.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thanks for the response, Quinn! From your link, it seems like AppleScript would be the way to implement this one-off escalation for a simple make directory and move file. I read the example in the appendix, but I'm having trouble testing it out in a C++ program... should this be done a different way in C++? Or can you point me to a way to include this kind of code in a C++ program?

Thank you.

I think I figured out how to compile a .mm file in a c++ project in order to run Obj-C. Case closed - thank you!

Polite location to store application data shared between users
 
 
Q