The correct way to write files to /Library

Hello - I’m creating an app that needs to copy ColorSync profiles to the /Library/ColorSync/Profiles directory on macOS and was wondering what is the correct / sanctioned way to write to the /Library directory is?

The app won’t be in the App Store. The app needs to run on Big Sur through Sonoma.

I spent some time working with ColorSyncProfileInstall() but that seems to want to ask the user permission every single time the function is called - and this app can install up to 25 profiles at a time. (There are actually hundreds of profiles that can be chosen that will come from a server).

I’m currently looking at using SMJobBless but that sure seems like using an atomic bomb to swat a mosquito. Any thoughts if SMJobBless is the right way to go? (SMAppService for 13 and on).

Thanks!

Note the default privileges for that directory is this:

% ls -ld /Library/ColorSync/Profiles
drwxr-xr-x  10 root  wheel  320 Sep  2 08:35 /Library/ColorSync/Profiles

To modify it, you need to be running as root. That means some sort of privilege escalation. There are various approaches you can take for that; see BSD Privilege Escalation on macOS for a summary.


Before you do that, however, I’m going to suggest a quick test. AFAICT ColorSync authorises this operation using the system.colorsync.install.profile right. If you call AuthorizationCopyRights for that right beforehand, and then call ColorSyncProfileInstall repeatedly, does that prevent the repeated authentications.

I don’t think it will, but I think it should (-:

Share and Enjoy

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

The correct way to write files to /Library
 
 
Q