Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I was wondering if anyone know where the System Preferences settings are stored on Mac OS X Lion? I presume there's some .plist with them somewhere.

I think that they might be stored in multiple .plist files. I'm looking for the setting for the brightness slider in particular because I'd like to be able to write a script that sets the brightness to be exactly the same for two monitors.

share|improve this question
add comment

3 Answers 3

Preference locations

Some system-wide settings are in /Library/Preferences, and some user settings are in ~/Library/Preferences. I say "some" because I have found settings in these locations before, but have not done an exhaustive search. Also, this is what could be called an implementation detail. It's not documented publicly by Apple, is not intended for users to manipulate directly (by editing the .plist files), and the way it works could change without warning in a future version of OS X. The fact that Apple made ~/Library hidden by default on Lion is a good indication that the contents of this directory are not intended to be modified by typical users. So, for best results, you should modify the settings indirectly through System Preferences itself.

Having said that, I changed the brightness of my iMac running 10.7.3, then went looking for changed plist files in the directories listed above. I couldn't find anything pertaining to screen brightness.

However, I was able to use Automator to record a workflow that opens System Preferences, goes to the Displays pref pane, and adjusts the brightness slider. This may be an easier and more reliable option for you. A quick Google search indicates that automator workflows can run from the command line, but I didn't try this.

I'll also add that one of my setups is a MacBook Air with a 30" cinema display. Setting the brightness to the same percentage on both (25% for example) does not mean that the brightness matches visually. You will likely need to choose different brightness levels for each display to get them to appear equally bright.

Monitoring filesystem usage by System Preferences

EDIT: The way you can see which plist files are accessed or modified while running System Preferences is to run a command like this in Terminal:

sudo fs_usage -w | grep "System Pref" | grep plist | grep -v "Info\.plist"

This command outputs a huge list of paths and files, some of which don't exist. File updates continued logging for a few seconds after I quit the app.

If you go this route, here's what I recommend:

  • Dump the list to a textfile
  • Eliminate duplicate paths
  • Look at the files which have been modified. Files with states such as "stat64", "open", and "getattrlist" are just being opened for reading, but files with states of "chmod" or "rename" are being modified. I saw my ~/Library/Preferences/com.apple.systempreferences.plist file get renamed with an extension of .CvkFEbo, which I believe is the system's way of performing an atomic file write (write the entire file under a different name, and if that is successful, rename it to the original filename).

Unfortunately, I still didn't turn up anything regarding a screen brightness setting persisted to disk, but I have only lightly skimmed the fs_usage results to now.

Command-line tool to control brightness

I found an article that lists source code for controlling screen brightness on OS X using the CoreGraphics framework. The article is a little over two years old, and I haven't tried it myself, but it may be useful to you. There are simple compiling instructions posted at the end.

share|improve this answer
    
Hey, thanks for your response. It's ok I'm aware of the issues of going in and and manipulate these things yourself but I would still like to know where the setting is stored. Using an Automator script would be a bit tedious because I was hoping to have my script run pretty much instantly from a simple shortcut. I would use AppleScript to script System Preferences but it doesn't look like SystemPrefs supports this. I don't think it matters if one screen requires a slightly brighter setting than another because I could compensate for that in the script by using a percentage like you suggest. –  James Bedford Feb 8 '12 at 9:54
add comment

/Library/Preferences/com.apple.iokit.AmbientLightSensor.plist

share|improve this answer
    
This .plist file doesn't exist for me (running Mountain Lion 10.8) in neither /Library/Preferences nor ~/Library/Preferences. Thanks. –  James Bedford Aug 5 '12 at 15:27
add comment

In Finder. Hold down the alt key and select the "Go" Menu. Library will be temporarily visible. If you want the Library permanently visible, open Terminal and type:

chflags nohidden ~/Library/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.