How to set dark mode appearance to auto in terminal I found the way to set dark mode:
defaults write -g NSRequiresAquaSystemAppearance -bool true

But have no idea set it to Auto with defaults write.
It could also be great to explain how you discovered this.
Thank you!
The answer is in step 7 and step 9.


Setup git in the ~/Library/Preferences/ folder to determine the incoming changes.

cd ~/Library/Preferences/
git init
git add .
git commit -m "init commit"

Open System Preferences -> General, change Appearance from Light to Auto. I found only .GlobalPreferences.plist has been changed.
Open .GlobalPreferences.plist in VSCode with Binary Plist plugin to view plist file as xml syntax.
Copy the .GlobalPreferences.plist file content in VSCode and paste to Diffchecker Original Text.
Change Appearance from Auto to Light.
Copy the .GlobalPreferences.plist file content in VSCode and paste to Diffchecker Changed Text. I found the diff content is:

&lt;key&gt;AppleInterfaceStyleSwitchesAutomatically&lt;/key&gt;
&lt;true/&gt;

Run the defaults write command to set the Appearance to Auto

defaults write -g AppleInterfaceStyleSwitchesAutomatically -bool true

Remove the .git in ~/Library/Preferences/
Log out and log in the computer.
Open System Preferences -> General. You'll see the Appearance is set to Auto.