I'm trying to copy a prepared Dock plist to another already existing user account. It seems simple enough:
sudo cp ./default.com.apple.Dock.plist /Users/$USERNAME/Library/Preferences/com.apple.Dock.plist
However, it does not work. I tried to rm -f the existing Dock plist first and then copying over the new one, I tried killing the Dock and not killing it afterwards, I tried rebooting the machine, I tried
cp -f, all don't matter. I still get the old Dock.
When I copy over the same Dock plist to the user template folder in /System and make a new account, it suddenly works as expected.
The account of the user who receives the new Dock plist is NOT logged in, by the way. Also the template Dock file is from another computer. However I don't think the file itself is corrupt, since it does work with new User accounts. Also the path is correct because the Modified date of the plist in /Preferences is updated.
What am I missing here? Some rights issues maybe?