How to set a different default User Agent in Safari? [duplicate]

You can set it with defaults write:

defaults write com.apple.Safari CustomUserAgent "\"useragentstring\""