Mathias Bynens Shows How to Automate Setting Many System Preferences

Mathias Bynens has a bash script that he uses to set many of the system preferences to match his desired. While I don't know that I would go that far, and definitely not all of the settings are to my taste, this script shows how to configure a why range of settings on your Mac which may well be of interest to Keyboard Maestro users (via mjtsai)

4 Likes

While it is nice to have all of your preferences set in one script, ==it can also be very dangerous if you don't understand what each setting does.==

There is a lot of debate about this script at Sensible macOS Defaults | Hacker News.

For example:

###############################################################################
# General UI/UX                                                               #
###############################################################################

# Set computer name (as done via System Preferences → Sharing)
#sudo scutil --set ComputerName "0x6D746873"
#sudo scutil --set HostName "0x6D746873"
#sudo scutil --set LocalHostName "0x6D746873"
#sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "0x6D746873"

I don't understand how to use this section of preferences.
What does the hex (?) number in quotes refer to?
Where do I put the ComputerName, for example, that I want to use?

Then I noticed that all of these lines are just comments, since they start with a #.

Before running a script like this, I would want to backup my current preferences, so I could easily and quickly restore them if something goes wrong.

So, ==I WOULD NOT run this entire file as one script==.
It is more useful to look through it and find specific preferences you might want to set, and then put those in a separate script file.

Of course, YMMV. Those of you that are bash gurus will likely find this more useful.

2 Likes

Here is another list of well-documented Bash commands to set preferences for the macOS and a number of apps:

Awsome macOS Command Line Shell Commands -- GitHub - herrbischoff

I have NOT carefully reviewed nor tested any of these commands.
I found it here:
Michael Tsai - Blog - Awesome macOS Command Line

But it does look very interesting.

3 Likes

Hey Guys,

Good stuff; thanks!  :sunglasses:

-Chris

This is great! Looking forward to diving in