Clipboard

Is there a way to clear the clipboard?

Posted on Feb 3, 2020 11:29 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 9, 2020 6:34 AM

If you don't mind launching the Terminal, and typing, then dialabrain's solution is a concise way to clear the clipboard. If you want to double-click a file on the Desktop to do exactly the same thing, without having to launch Terminal yourself, then you can use a Terminal command file.


Place the following code in a text file on your Desktop named clipCLR.command. Make it executable by you.

#!/bin/zsh

# clear the clipboard
pbcopy < /dev/null
exit


When you double-click this clipCLR.command file in the Finder, it will instantly launch Terminal, run this script, and exit the Terminal. The clipboard is cleared. It would also work with Bash as the shell instead of Zsh.

17 replies
Question marked as Top-ranking reply

Feb 9, 2020 6:34 AM in response to Verin1174

If you don't mind launching the Terminal, and typing, then dialabrain's solution is a concise way to clear the clipboard. If you want to double-click a file on the Desktop to do exactly the same thing, without having to launch Terminal yourself, then you can use a Terminal command file.


Place the following code in a text file on your Desktop named clipCLR.command. Make it executable by you.

#!/bin/zsh

# clear the clipboard
pbcopy < /dev/null
exit


When you double-click this clipCLR.command file in the Finder, it will instantly launch Terminal, run this script, and exit the Terminal. The clipboard is cleared. It would also work with Bash as the shell instead of Zsh.

Feb 9, 2020 7:11 AM in response to Verin1174

The clipboard is a "magical" place = in RAM (or scratch disk)

It keeps only ONE THING at a time - if it is a LARGE thing, it likely is a reference TO the original

test this by copying an image from a file on your Mac, then Trashing (and EmptyingTrash) the file before you PASTE (I cannot test, no Mac working now)


MUCH MUCH easier to clear it is copying OVER whatever you are worried about lurking there with a single character " § " 😁

Feb 9, 2020 7:43 AM in response to VikingOSX

VikingOSX wrote:

Works fine on Catalina 10.15.3 and Mojave 10.14.6 for me with the Terminal closing (and quitting). Using identical Terminal profiles and settings on both which I verified just to be sure. More Apple intrigue. 🤬

The following Applescript will zap the clipboard contents too:

set the clipboard to white space


How BIG (filesize) is "white space" ?

Is it "text" (spacebar space)


Enquiring Minds Want to KNOW!


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Clipboard

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.