"Permission Denied" writing to /Library on Mac

Hey JUCE world,

I working on a plug-in and trying to save presets to the system /Library directory on macOS. When I try to do this I get a “Permission denied” error, in this case when creating a new preset file in a subdirectory of /Library. Does anyone out there know how to work around this? How to give the plug-in permission to write to this directory?


The convention is to write stuff like that to a sub-directory of ~/Library/Application Support, mostly I guess because stuff like a user preset should not be visible to other users on the system. More recently I’ve seen a trend towards putting presets etc in ~/Music, though personally I dislike that.

At the risk of sounding like a Python Stackoverflow “answer”: why do you want to write to the system Library folder rather than the users?

I agree with @asimilon that a good place for presets would be ~/Library/Application Support/.

However, if you want to make the presets available to all users, then /Library/Application Support/ would be best. (So says the Apple dev support eskimo.) The proper way of doing it, I believe, is to dip into Swift in your c++ code to run some Applescript that runs Shell code with administrator privileges.

The easier way that doesn’t look as good is to call osascript in Juce child process so you don’t have to get into swift.

Apple’s guide on admin privs:

The “blessed” location for sandbox-safe plugins (which is to say anything that has to work in Logic/Mainstage/Garageband) is ~/Music. A sandboxed plugin can only write to the app’s own sandboxed directory tree and ~/Music. This is the directory you should use for cross-format presets.