Apple - Where does OS X store your current desktop picture?
In current versions of macOS (at least in Mojave, probably since Sierra, not sure about others) the location of the desktop pictures are stored in a SQLite database located at ~/Library/Application Support/Dock/desktoppicture.db
.
I did not dig into details of the database structure but you can get the file path with this command:
sqlite3 -readonly ~/Library/Application\ Support/Dock/desktoppicture.db \
'SELECT * FROM data ORDER BY rowID DESC LIMIT 1;'
Starting in Lion, I don't think Lion caches desktop pictures anymore (possibly because you can have multiple at a time, for different desktops/spaces).
In that case, use plutil -p
to dump the binary plist file in text form using terminal:
plutil -p ~/Library/Preferences/com.apple.desktop.plist
The Apple delivered desktop images are stored in /Library/Desktop Pictures , so you can eliminate those (or seek those if you used an Apple picture for one or more spaces). Before Lion, the preference file that controls desktop images is text format any to find out the current image, open ~/Library/Preferences/com.apple.desktop.plist
in a text editor and find the first ImageFilePath
property. That will tell you the path to the current desktop image.
If you just go into system preference, then desktop. you can simple click and drag the little image you have onto your desktop.