How do I change the global stylesheet of Safari from the command line on OS X? I am looking for a command line solution to change Safari default stylesheet.

This can be configured manually by going to Safari > Preferences > Advanced > Style sheets.

Still, I need this in order to be able to reconfigure a system or deploy the settings.
I've set a stylesheet in Safari and these are the changes that occurred in Safari's plist:

UserStyleSheetEnabled = 1;
UserStyleSheetLocationURLString = "~/Desktop/dsa.css";
WebKitUserStyleSheetEnabledPreferenceKey = 1;
WebKitUserStyleSheetLocationPreferenceKey = "~/Desktop/dsa.css";


Your command line would be:

defaults write com.apple.safari UserStyleSheetEnabled 1 &amp;&amp; defaults write com.apple.safari UserStyleSheetLocationURLString "/path/to/css" &amp;&amp; defaults write com.apple.safari WebKitUserStyleSheetEnabledPreferenceKey 1 &amp;&amp; defaults write com.apple.safari WebKitUserStyleSheetLocationPreferenceKey "/path/to/css"