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
.
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.
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.
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
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).
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 (3)
Didn't know about Hazel. Thanks for sharing Erick!
My man living his daily life in the Recycle Bin