How to take photo using Terminal? Is it possible to take a photo or record a short video with the MacBook's webcam using Terminal?

sh-3.2# system_profiler SPSoftwareDataType 
Software:

    System Software Overview:

      System Version: macOS 10.13.4 (17E199)
      Kernel Version: Darwin 17.5.0
      Boot Volume: lily
      Boot Mode: Normal
      Computer Name: lily’s MacBook Air
      User Name: System Administrator (root)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
Use FFMPEG.
(This has become one of my favorite command line utilities for video/audio conversion and streaming)
According to the FFMPEG Wiki, you can use Apple's AVFoundation to capture directly from the FaceTime Camera or any other USB web cam that's attached.  Keep in mind, the wiki was written when the FaceTime camera was still called the iSight so some of the features/keywords are no longer valid
Get the device ID
$ ffmpeg -f avfoundation -list_devices true -i &quot;&quot;

[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation video devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] FaceTime HD Camera (Built-in)
[AVFoundation input device @ 0x7fda1bc152c0] [1] Capture screen 0
[AVFoundation input device @ 0x7fda1bc152c0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fda1bc152c0] [0] USB Audio CODEC
[AVFoundation input device @ 0x7fda1bc152c0] [1] Built-in Microphone

The device we're looking for is &quot;0&quot;
Capture the photo
$ ffmpeg -ss 0.5 -f avfoundation -i &quot;0&quot; -t 1 capture.jpg

What this does is take a 1 second video stream, takes the single fram starting at .5 seconds and saves it as a JPEG called capture.jpg