MacOS – Why is screencapture taking the screenshot of the desktop image and not the windows on top in Catalina

catalinacommand linemacosscreen capture

Why is screencapture command only takes the screenshot of the desktop image and not the windows on top in Catalina? I keep on trying on Catalina compared to High Sierra or Mojave where this is not the case with screencapture command.

Here is the link to the shell script on my Github: https://github.com/shyamalschandra/screenshot2speech The relevant command is

screencapture -s ~/Downloads/screen.png

http://osxdaily.com/2011/08/11/take-screen-shots-terminal-mac-os-x/

Best Answer

Instead of screencapture -s ~/Downloads/screen.png source where -s is for

Only allow mouse selection mode.

try -w. It will show a camera icon and wait for you to select a window. Hit esc to cancel the process.

screencapture -w ~/Downloads/screen.png

-w Only allow window selection mode.

I cannot say why -s doesn't work, but on Mojave, the man page says

The screencapture utility is not very well documented to date. A list of options follows.