Disable Set Desktop Picture in Photos

By Morgan Rowe | 04 Dec 2015

Photos was launched in 2015 with OS X 10.10.3. The application was designed to replace both iPhoto, an application designed to help you manage and touch up your photos; and Aperture, a beefier version of iPhoto aimed at power users or photographers who wanted higher fidelity when working with their images.

The new Photos application came with a slew of new features, one of which is the new Share options. Among the new sharing options, there is one for setting a selected photo as the desktop wallpaper called 'Set Desktop Picture'. This is great for users that don't need to have their wallpaper enforced, but for Mac admins who're trying to configure a specific wallpaper, it's a bit of a nuisance. As far as I can tell, Photos uses its own way of configuring the Mac's wallpaper rather than reaching out to existing workflows that can be deleted or 'locked'.

Disable Set Desktop Picture in Photos—Share menu

I couldn't see any preferences in Photos' property list files and there was no database to play around with in the Application Support directory. However, I found that Photos stores all of the images that have been shared via Set Desktop Picture to a directory named Photos Desktop in ~/Library/Containers/ on OS X Yosemite or ~/Library/Containers/ Support/ for OS X El Capitan. Removing all write access to these folders effectively disables Photos' Set Desktop Picture feature. Great, but how do we enforce this for all users?

The script below simply removes write permissions of the Photos Desktop directory, which disallows the application from caching the photos and consequently changing the desktop wallpaper. This probably causes an error, but Photos handles it nicely, not even throwing up an error message to annoy users.

The most up to date script with comments and human readable white spacing can be viewed on GitHub, but you can also view it here:


photosAppVersion=$(/usr/bin/defaults read /Applications/ CFBundleShortVersionString)
photoDesktopYos=$photosContainer/Data/Library/Caches/Photos\ Desktop
photoDesktopElCap=$photosContainer/Data/Library/Application\ Support/Photos\ Desktop

/bin/sleep 3
if [ ! -f "$photosDesktopCheck" ]; then
	if [[ "$photosAppVersion" == "1.2"* ]]; then
	if [ -d "$photosContainer" ]; then
		if [ -d "$photoDesktop" ]; then
			$chmod 000 "$photoDesktop"
			$touch "$photosDesktopCheck"
			$mkdir "$photoDesktop"
			$chmod 000 "$photoDesktop"
			$touch "$photosDesktopCheck"
exit 0

Save this script somewhere to the target machine. Scripts like these usually live in /usr/local/bin/. I'm going to call mine ''.

We have the script but we'd like it to run automatically for all users. We can achieve this using launchd. We don't want the script to be running all the time as a user may never open Photos, so the script should only fire when Photos opens or is being used. To accomplish this, we simply need to save a daemon into /Library/LaunchAgents/. I used the following commands to make the daemon. Remember to prepend each command with sudo if you're not running the commands as root:

defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist Label "com.ehcho.disable-set-desktop-picture-in-photos"
defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist WatchPaths -array
defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist WatchPaths -array-add "~/Library/Containers/"
defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist ProgramArguments -array
defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist ProgramArguments -array-add "/usr/local/bin/"
defaults write /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist RunAtLoad -bool true

Finally, we'll need to ensure the permissions are correct for both the daemon and the script itself:

chown root:wheel /usr/local/bin/
chmod 755 /usr/local/bin/
chown root:wheel /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist
chmod 644 /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist

Restarting the machine will automatically load the daemon for all users, or it can be loaded manually:

launchctl load -w /Library/LaunchAgents/com.ehcho.disable-set-desktop-picture-in-photos.plist

The script has been tested on both OS X Yosemite and El Capitan. There were some slight differences between where the cached photos were saved between operating systems, but the script accommodates this easily. Enjoy!