Home » , , » How to Change Your Wallpaper in Mac OS X Using the Command Line

How to Change Your Wallpaper in Mac OS X Using the Command Line

Here's a fun and quick way to change your wallpaper in Mac OS X using the command line.

To change the desktop wallpaper from the command line of OS X you will use the osascript command, which is actually just the command line front end to AppleScript, as you’ll see with some basic applescript in the syntax:
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/path/to/picture.jpg"'
For example, to set a picture on the desktop called “cabo-san-lucas.jpg” as the wallpaper:
$ osascript -e 'tell application "Finder" to set desktop picture to POSIX file "~/Desktop/cabo-san-lucas.jpg"'
Note: There is no confirmation, the wallpaper will just change instantly.

Bonus Tip: For most Mac users, you’ll set wallpaper from OS X System Preferences or by right-clicking on a picture somewhere in the file system, which is undoubtedly the fastest and most efficient means of changing the Macs desktop background, but for those who like to be a bit more hands on or who need to know how to adjust desktop background pictures from the command line.

Source: osxdaily.com