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
~/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
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
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.
/tmp directory is the solution to the problem of a hard drive full of random stuff.
/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
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
⇧⌘4 create a new screenshot
My flipped configuration is:
⇧⌘3copy picture of screen to the clipboard
^⇧⌘3save picture of screen as file
⇧⌘4copy picture of selected area to the clipboard
^⇧⌘4save picture of selected area as file
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
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).
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)
Didn't know about Hazel. Thanks for sharing Erick!
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!
My man living his daily life in the Recycle Bin