Suddenly unable to screenshot- Do not have permission to save files in the location where screenshots are stored

permissionscreen captureterminal

Recieved the error:
'Your screenshot could not be saved. You don't have permission to save files in the location where screenshots are stored.' with OS X Yosemite.

I opened terminal and tried directing the screenshots to save on my desktop:

Brigittes-Air:~ eggsalad$ defaults read com.apple.screencapture location
2017-01-06 03:04:47.765 defaults[17729:1947540]
The domain/default pair of (com.apple.screencapture, location) does not exist

So I tried writing and:

Brigittes-Air:~ eggsalad$ defaults write com.apple.screencapture location ~/Desktop
2017-01-06 03:05:08.652 defaults[17742:1948451] Could not write domain com.apple.screencapture; exiting

I'm not sure where the screenshots are being stored if the location does not exist. Ideas?

EDIT

I ran something else and got a different response, but defaults are still unchanged.

Brigittes-Air:~ eggsalad$ defaults write com.apple.screencapture location/Users/eggsalad/Desktop killall SystemUIServer

2017-01-06 03:22:35.444 defaults[18265:2001767] Unexpected argument SystemUIServer; leaving defaults unchanged.

2nd EDIT
Result of:
ls -l ~/Library/Preferences/com.apple.screencapture.plist

was:

ls: /Users/eggsalad/Library/Preferences/com.apple.screencapture.plist: No such file or directory

Best Answer

You may have just gotten the commands wrong. Try

defaults write com.apple.screencapture location /Users/eggsalad/Desktop

make sure to press Return, then

killall SystemUIServer

and press Return again.

Then run

defaults read com.apple.screencapture location

As a last resort, just reset all the settings for your user:

 defaults delete com.apple.screencapture