Finding macOS command line settings and options (#note)

If you’re using a Mac, you might have come across tutorials explaining how to change particular macOS configuration via the command line.
For example, I google and found this command to add a spacer tile to the macOS dock.
defaults …

If you’re using a Mac, you might have come across tutorials explaining how to change particular macOS configuration via the command line.

For example, I google and found this command to add a spacer tile to the macOS dock.

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'

These commands can offer functionality that is not available via the GUI. Additionally, they allow users to automate and script their general macOS configuration. When you’re setting up a new development machine, an automated setup can save you hours.

These automation scripts are often places in so-called dotfiles projects. These projects include config files such as .gitconfig and .vimrc and scripts that install additional software and configure the operating system.

Have a look at two examples:

The macOS configuration section in Mathias’ dotfiles includes 226 (?) of default write commands. That’s a lot of automation!

When looking at the public dotfiles, I always wondered how people find the commands to change and save macOS settings. As you’ve seen in the command above, these operating system settings are not guessable.

Today I read the post Change macOS user preferences via command line post written by Paweł Grzybek, and he shared a nifty approach to discovering the commands and arguments yourself.

It includes a plain old diff of your settings’ overall state, but read the post yourself; if you want learn more about automating you macOS setup, this post is worth it.



Reply to Stefan


Print Share Comment Cite Upload Translate
APA
Stefan Judis | Sciencx (2024-03-28T20:56:57+00:00) » Finding macOS command line settings and options (#note). Retrieved from https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/.
MLA
" » Finding macOS command line settings and options (#note)." Stefan Judis | Sciencx - Monday January 18, 2021, https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/
HARVARD
Stefan Judis | Sciencx Monday January 18, 2021 » Finding macOS command line settings and options (#note)., viewed 2024-03-28T20:56:57+00:00,<https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/>
VANCOUVER
Stefan Judis | Sciencx - » Finding macOS command line settings and options (#note). [Internet]. [Accessed 2024-03-28T20:56:57+00:00]. Available from: https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/
CHICAGO
" » Finding macOS command line settings and options (#note)." Stefan Judis | Sciencx - Accessed 2024-03-28T20:56:57+00:00. https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/
IEEE
" » Finding macOS command line settings and options (#note)." Stefan Judis | Sciencx [Online]. Available: https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/. [Accessed: 2024-03-28T20:56:57+00:00]
rf:citation
» Finding macOS command line settings and options (#note) | Stefan Judis | Sciencx | https://www.scien.cx/2021/01/18/finding-macos-command-line-settings-and-options-note/ | 2024-03-28T20:56:57+00:00
https://github.com/addpipe/simple-recorderjs-demo