DEV Community

Stefan Judis
Stefan Judis

Posted on • Originally published at


Why I don't need to clean up my desktop and downloads folder in macOS

I saw an interesting discussion on Twitter today. People were talking about messy desktops and the always full Downloads folder on macOS. These two directories are usually full of two different file types: random internet downloads and lots of screenshots.

Let me tell you a secret! I didn't need to clean up ~/Downloads or ~/Desktop for a year now because I changed a few macOS settings. There are two tricks to get rid of the problem of too many files on your hard drive.

Say hi to /tmp (or /private/tmp)

Here's the thing. On macOS, there's the /tmp directory. This directory is used for temporary operating system files, and it's automatically cleaned up after you reboot your machine.

When you navigate to / and list the files and directories in that location, you see that /tmp is symlinking to /private/tmp.

Directory listing of / showing that tmp is a symlink to private/tmp

I don't know enough about the symlink's historical reasons, but I'm using the /tmp directory every day. It doesn't matter if I'm setting up a quick coding prototype or download random files. When I know that I don't want to keep files, I place them there and forget about them.

The /tmp directory is the solution to the problem of a hard drive full of random stuff.

macOS finder showing a tmp sidebar shortcut

To access /tmp quickly, I added a shortcut to my macOS Finder, too.

Store downloads in a directory that's automatically cleaned up

I configured my main browser (Firefox) to store downloads by default in /private/tmp, too.

Firefox settings routing downloads to /private/tmp

Whenever I download a file, I can look at it, close it and call it a day. ๐ŸŽ‰ And when the file is important, I'll move or save it in the correct location (which you have to do anyways when Downloads is the default).

Copy screenshots to the clipboard instead of saving them to disk

By default, macOS stores screenshots at ~/Desktop. Many programs and websites that I use (Keynote, Slack, Twitter, etc.) allow uploading images directly from the clipboard by hitting paste. I flipped the macOS shortcut settings in the keyboard preferences to copy a screenshot to the clipboard instead of creating a new file. By default โ‡งโŒ˜3 and โ‡งโŒ˜4 create a new screenshot png file.

My flipped configuration is:

  • โ‡งโŒ˜3 copy picture of screen to the clipboard
  • ^โ‡งโŒ˜3 save picture of screen as file
  • โ‡งโŒ˜4 copy picture of selected area to the clipboard
  • ^โ‡งโŒ˜4 save picture of selected area as file

Shortcut settings to copy screenshot to clipboard in macOS

This setting works perfectly. There's no unnecessary file going anywhere on my computer for the programs allowing me to paste images.

And if I really need to save a screenshot to disk because a website is not supporting "paste upload", I changed the settings and the image is stored in /tmp, too.

To adjust the screenshot location, you have run the command below in your terminal.

echo "Store screenshots in /tmp"
defaults write location /tmp
Enter fullscreen mode Exit fullscreen mode

(if you're curious about more macOS settings, have a look at my dotfiles).

With these two settings, I'm leveraging the /tmp directory to stop worrying about overflowing directories on my machine. I only have to deal with files being stored on my hard drive when I know I want to keep them.

Pssst... if you enjoyed this post, I'm running a weekly newsletter including tricks like that and web development news.

Top comments (4)

stefanjudis profile image
Stefan Judis

Didn't know about Hazel. Thanks for sharing Erick!

theimpulson profile image
Aayush Gupta

Pretty awesome tip. I manually clean my Downloads and Desktop every once in a while but this tip seems it will save a lot of time. Thanks for sharing!

qm3ster profile image
Mihail Malo

My man living his daily life in the Recycle Bin