How to reverse the defaults write com.apple.Safari CustomUserAgent “\”My user agent string\“” command

defaultssafariweb-browser

Using the defaults write com.apple.Safari CustomUserAgent "\"My user agent string\"" command, you can set the default User Agent for Safari. This means that the CustomUserAgent key gets written in ~/Library/Preferences/com.apple.Safari.plist.

<key>CustomUserAgent</key>
<string>My user agent string</string>

But how can you reverse this action? (Manually deleting the two rows from the plist doesn’t work, as they just get rewritten when Safari restarts.)

Best Answer

defaults delete com.apple.Safari CustomUserAgent