Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

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.