How to set dark mode appearance to auto in terminal
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.