Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 3 down vote accepted

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 UserStyleSheetEnabled 1 && defaults write UserStyleSheetLocationURLString "/path/to/css" && defaults write WebKitUserStyleSheetEnabledPreferenceKey 1 && defaults write WebKitUserStyleSheetLocationPreferenceKey "/path/to/css"
share|improve this answer
Thanks a lot! I just integrated the solution to my my code – sorin Jul 12 '12 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.