Step 1: What Is This APOD?
Step 2: Time for Some Script-fu!
I'd been visiting the page at least once a day for a while before I realized that I could write a simple script to set it as my wallpaper each day. An hour of coding and debugging (BASH isn't my favorite...) later, I was finished! Here is the fruit of my efforts!
Copy the following into a text editor and save as getApod.command to your Desktop (sorry! My computer doesn't seem to like uploading the file!)
#script to download today's NASA Astronomy Picture of the Day and set it as the wallpaper
wget -N http://apod.nasa.gov/apod/astropix.html;
wget -N -O todaysImage.jpg http://apod.nasa.gov/apod/$(grep -o "image.*\.jpg" astropix.html | head -n1);
osascript -e 'tell application "Finder" to set desktop picture to "Hard Drive:Users:<YOUR NAME>:nasapics:todaysImage.jpg" as alias';
PS This script only works for macs ATM, because it uses AppleScript to set the desktop picture. Hopefully theres a Linux wizard out there who could fix up something...)
To set up the script for your computer, just follow these simple steps:
1. Make a new folder in your home directory called nasapics (/Users/
2. Change path in the line that says "osascript -e 'tell application "Finder" to set desktop picture to "Hard Drive:Users:<YOUR NAME>:nasapics:todaysImage.jpg" as alias';" to reflect the location of the nasapics folder on your hard drive
NOTE: Because the script is in a .command file, it will open automatically in Terminal when you double click it. Right click and use "Open With" to select your favorite text editor
To pretty it up a little, move the script to to your desktop, then right click -> Get Info. Copy the NASA logo on this page, then double click on the icon in the top-left (as shown in the picture below) until it gets a blue outline. Then CMD-V to paste the logo there. TADAH!
Step 3: Using the Script
NOTE: You might get an error if you first use this script when the APOD is not a picture (sometimes its a video). In that case, just wait a day, and you should be good to go!
Step 4: How Does It Work?
1. Make the nasapics folder the working directory
2. Use wget to download the html for the APOD page, use grep to search for the link to the image, and wget again to download the image from that link.
3. Use AppleScript to set the wallpaper