Skip to content

Commit 9a6a40b

Browse files
committed
Add Capture Screenshot To Clipboard From CLI as a Mac TIL
1 parent 4b4bd23 commit 9a6a40b

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1663 TILs and counting..._
13+
_1664 TILs and counting..._
1414

1515
See some of the other learning resources I work on:
1616

@@ -681,6 +681,7 @@ If you've learned something here, support my efforts writing daily TILs by
681681
- [Access All Screen And Video Capture Options](mac/access-all-screen-and-video-capture-options.md)
682682
- [Access System Information On OS X](mac/access-system-information-on-osx.md)
683683
- [Access Unsupported Screen Resolutions With RDM](mac/access-unsupported-screen-resolutions-with-rdm.md)
684+
- [Capture Screenshot To Clipboard From CLI](mac/capture-screenshot-to-clipboard-from-cli.md)
684685
- [Check Network Quality Stats From The Command Line](mac/check-network-quality-stats-from-the-command-line.md)
685686
- [Clean Up Old Homebrew Files](mac/clean-up-old-homebrew-files.md)
686687
- [Convert An HEIC Image File To JPG](mac/convert-an-heic-image-file-to-jpg.md)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Capture Screenshoot To Clipboard From CLI
2+
3+
MacOS comes with a `screencapture` utility that you can run from the terminal
4+
to activate the built-in screenshot functionality on Mac.
5+
6+
Usually when I am taking a screenshot, I want to do something with it right
7+
away. Such as paste it into an application or group chat. The `-c` flag forces
8+
the screen capture to go the clipboard.
9+
10+
I also generally want to capture a specific area of the screen so that the
11+
captured image includes the right amount of context and nothing more. The `-i`
12+
flag puts you in interactive screen capture mode. That means your cursor will
13+
turn into a crosshair that you can use to make a drag selection of the capture
14+
area.
15+
16+
```bash
17+
$ screencapture -ic
18+
```
19+
20+
Select an area to capture, it's now on your clipboard, paste it where you need
21+
it.
22+
23+
Note: The first time you run this command, your terminal program (e.g. iTerm2)
24+
may prompt you for the necessary OS permissions in order to capture images of
25+
your screen. You'll need to grant those permissions and then rerun the command.
26+
27+
See `man screencapture` for more details.

0 commit comments

Comments
 (0)