Why I don't need to clean up my desktop and downloads folder in macOS
Tags: productivity
Published: 2021-03-04 22:23:27

---
title: Why I don't need to clean up my desktop and downloads folder in macOS
published: true
description: How to leverage the tmp directory to not store random files on your macOS computer.
tags: productivity
canonical_url: https://www.stefanjudis.com/blog/why-i-dont-need-to-clean-up-my-desktop-and-downloads-folder-in-macos/
//cover_image: https://direct_url_to_image.jpg
---

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](//images.ctfassets.net/f20lfrunubsq/2niX9nzmTIfuen24TBywJ8/fde6f940f2537ae95b6efc123c6577a3/Screenshot_2021-03-04_at_20.02.09.png)

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](//images.ctfassets.net/f20lfrunubsq/6nfh9PRiRLlMUlQQt45N8N/6f8182890d6e4d013a54effd9fc3402d/Screenshot_2021-03-04_at_20.09.33.png)

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](//images.ctfassets.net/f20lfrunubsq/6JzG1ZtG0OM4WtM8kZLZBS/e0671b5f96039f9c09842f5f5a184e22/Screenshot_2021-03-04_at_19.52.43.png)

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](//images.ctfassets.net/f20lfrunubsq/14U6KJQKRr164v7oiZXutb/c1c7833f328ee7122fdd1e9366564304/Screenshot_2021-03-04_at_19.55.33.png)

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 com.apple.screencapture location /tmp
```

(if you're curious about more macOS settings, [have a look at my dotfiles](https://github.com/stefanjudis/dotfiles/blob/primary/scripts/mac.sh)).

---

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](https://www.stefanjudis.com/newsletter/).*