NEVER manipulate directly any of the files in ~/Library/Preferences. All preferences are managed by a background process named cfprefsd (short for Core Foundation PREFerences Daemon), which slurps up and caches in RAM the files in ~/Library/Preferences. It used to be that you could often get away with manipulating preference files behind cfprefsd's back, so to speak, but cfprefsd has recently gotten very aggressive about how much it caches.
Instead of editing one of these files, ask cfprefsd for a copy, edit the copy, and then send the contents of the copy back to cfprefsd. Your interface to cfprefsd is the defaults shell command.
For example, to edit the preferences for the com.apple.sidebarlists domain:
defaults read com.apple.sidebarlists > ~/Desktop/sidebarlists.txt
... edit sidebarlists.txt to your heart's content
defaults write com.apple.sidebarlist "$(cat ~/Desktop/sidebarlist.txt)"
You will need to make Finder aware of the changes, so throw in
osascript -e 'tell application "Finder" to quit'
sleep 0.2 # not always necessary
osascript -e 'tell application "Finder" to activate'
Remember to play nicely with other programs. Killing isn't nice, so don't kill anything (especially not cfprefsd) that you don't absolutely need to kill. Don't jerk around with another program's persistent store while it's running. In particular, since cfprefsd is always running, NEVER directly alter the contents of ~/Library/Preferences/*.
If you need to delete a preferences file, the right way is with:
defaults delete its.domain.name
Let cfprefsd worry about getting rid of the file (or, as it is wont to do nowadays, rewriting an essentially empty file on top of it).
The filename ~/Desktop/sidbarlist.txt is, of course, only an example. Use a .plist extension instead of .txt if you prefer. The file will be in NextStep text plist format.
If you prefer some other property list format, use pllist -convert ...
. Or let the defaults command write it as a .plist file in a format of its choosing with
defaults write ~/Desktop/sidebarlists "$(defaults read com.apple.sidebarlists)"
... edit the file ...
defaults write com.apple.sidebarlists "$(defaults read ~/Desktop/sidebarlists)"
But the important thing is that you keep your copy, the one you edit or otherwise manipulate, out of ~/Library/Preferences. Let defaults worry about communicating with cfprefsd, and let cfprefsd worry about manipulating ~/Library/Preferences.