Am looking to edit system preferences settings via the command line but cannot for the life of me find the correct names of variables.

In Login Options under Users & Groups, I would like to be able to change the Display login window from list of users to 'name and password'.
In Date & Time, I would like to know how I change the time to a server we use. Enable fields in Sharing Setup Energy Saver settings

It would be great if someone can help me out or point me in the right direction as I know you edit the preferences .plists but its knowing what to add or finding the preferred naming conventions.


  • 1
    Did you manage to configure the login options?
    – user87208
    Commented Aug 8, 2014 at 20:49

3 Answers 3


First off, you can check out a website that lists a lot of these things: http://secrets.blacktree.com/

I, however, just took a brute-force solution:

Copy the Preferences folder

$ cp -r /Library/Preferences before

Launch System Preferences. Make a change via the GUI. Probably best to do one change at a time, e.g. I changed "Display Login Window as:" from "List of users" to "Name and password". Quit System Preferences.

Copy the Preferences folder again:

$ cp -r /Library/Preferences after

See which files changed:

$ diff -ur before after
Binary files before/Preferences/com.apple.loginwindow.plist and after/Preferences/com.apple.loginwindow.plist differ

Compare the two versions. Since they are binary files, you'll need to convert them to XML for comparison. I use an alias for this:

$ alias plist='plutil -convert xml1 -o /dev/stdout'
$ diff -u <(plist before/Preferences/com.apple.loginwindow.plist) <(plist after/Preferences/com.apple.loginwindow.plist)
--- /dev/fd/63  2013-01-23 18:20:29.000000000 +0200
+++ /dev/fd/62  2013-01-23 18:20:29.000000000 +0200
@@ -9,7 +9,7 @@
-   <false/>
+   <true/>

At this point we have located the setting. Confirm we have it with defaults:

$ defaults read /Library/Preferences/com.apple.loginwindow SHOWFULLNAME
$ sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool false
$ defaults read /Library/Preferences/com.apple.loginwindow SHOWFULLNAME

Launch System Preferences and confirm it changed.

  • seems like a good solution, but I get warnings of Operation not permitted and Permission denied when copying preferences, even if I prepend sudo. Using MacOS Ventura 13.4
    – Levi
    Commented Jun 11, 2023 at 7:11
  • @Levi: I'm also on 13.4. I see 6 files with errors/warnings. 3 of the files require root/wheel to read, and sudo helps with those. 2 are warnings that "extended attributes" weren't copied over. That's fine; we don't need them for this purpose. The last file (com.apple.TimeMachine.plist) is not readable, but I'm not sure why not. Unless you're tweaking TimeMachine-related settings, we're still good.
    – Noach
    Commented Jun 19, 2023 at 16:46
  • blacktree link is broken
    – Memke
    Commented Aug 18, 2023 at 6:09
  • @Memke: Yep... sometime in the past decade the site shut down. :(
    – Noach
    Commented Aug 27, 2023 at 9:58

sudo opensnoop -n cfprefsd shows what property lists are being accessed. You can also just sort the preference files by modification date: ls -t {~,}/Library/Preferences/{ByHost,}.

For preferences in the user domain, you can also run defaults read > temp, change some preference, and run diff temp <(defaults read).

  • 3
    on macOS 10.12.1, opensnoop just prints error messages; first dtrace: system integrity protection is on, some features will not be available, then a list of messages like dtrace: error on enabled probe ID 5 (ID 167: syscall::open:return): invalid user access in action #11 at DIF offset 2; the second part seems to work well
    – ssc
    Commented Dec 8, 2016 at 14:49

You can use AppleScript to control many of the System Preferences properties. See https://www.macosxautomation.com/applescript/features/system-prefs.html for examples.

Depending on what you want to do, you can create a script to do things like

$ set-setting "dock preferences" "autohide:true, magnification:false"

Use the Script Editor.app to run and debug code in case the property labels have changed in newer macOS versions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .