Set the Desktop Wallpaper from the Terminal with osascript
Change every desktop's picture by scripting Finder through osascript — no System Settings clicking.
Run osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/path/to/image.jpg"' to change the wallpaper.
01Command
Command
$ osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Users/you/Pictures/mountain.jpg"'02What it does
There is no dedicated wallpaper binary on macOS, but AppleScript can drive Finder's 'desktop picture' property, and osascript runs AppleScript from any shell. This works well in scripts — for example picking a random photo from a folder every morning with launchd. The image path must be absolute; relative paths silently fail.
03Risk
!Warning: The Terminal (or your script runner) needs Automation permission to control Finder; macOS will prompt once. This changes the wallpaper for all spaces on all displays.
04Undo
Undo
$ osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/System/Library/Desktop Pictures/Sonoma.heic"'05Sources
- osascript - execute AppleScriptEvidence: Documents running AppleScript from the shell with osascript -e, including Finder automation.
Last verified: 2026-09-18 · Category: Media