I need to know if the current user is being managed by Mac OS X Parental Controls (more specifically, the app age restrictions) in order to block some contents of the app. How can I do that? Any of these will be enough.
Methods that can be achieved with Objective-C, but not necessarily using Objective-C, like bash commands or AppleScript commands, are also accepted.
EDIT: The app age restriction can be found here: https://ibb.co/mOZyww
First, I'm not sure what you mean by
app age restrictions
On macOS 10.13, I only see the option to restrict applications to a whitelist; I can't configure restrictions based on age.
Anyway, parental controls are stored in the local directory services, in the mcx_attributes
attribute for the user in question.
(mcx refers to the old Managed Preference framework)
You can browse this via the UI using Directory Utility or via dscl
(using the mcx plugin).
If you run dscl
, you can then browse the directory services using cd
, ls
, etc.
For example, I can navigate to my testuser:
cd /Local/Default/Users/testuser
And then dump the parental controls with mcxexport
-mcxexport .
This will give you the configured parental controls in XML format.
Check out dscl . -mcxhelp
for more information.
Updated
Toggling the "Restrict: Apps to:" setting updates this preferences key:
<key>gamesLimit</key>
<dict>
<key>state</key>
<string>always</string>
<key>value</key>
<integer>300</integer>
</dict>
You would have to play around with it to figure out the corresponding values (e.g. 300 == Age 12+)