Reposted from: http://www.twam.info/software/read-out-canon-eos-7d-shuttercount-on-os-x
If you own a Digital single-lens reflex (DSLR) camera you might want to read out the shutter count. For my Canon EOS 7D this can be done very easily using gPhoto2. gPhoto2 is a free open-source tool which supports more than 1300 cameras. As it is written for Unix-like systems it can be compiled for OS X very easily. If you have Homebrewinstalled, you can install it easily via the terminal by running
brew install gphoto2
Homebrew will install some libraries and gphoto2. Now we can switch on the camera and connect it by USB. If we ask gPhoto2 to query all support config options by
gphoto2 --list-config
we might receive an error like
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (m). Make sure no other program or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device. *** Error (-53: 'Could not claim the USB device') ***
This is because OS X starts the Picture-Transfer-Protocol daemon which occupies the device. We can quit the daemon by
killall PTPCamera
If we now try again to readout the support config options by
gphoto2 --list-config
we should receive a list like
/main/actions/bulb /main/actions/uilock /main/actions/syncdatetime /main/actions/autofocusdrive /main/actions/manualfocusdrive /main/actions/eoszoom /main/actions/eoszoomposition /main/actions/eosviewfinder /main/settings/datetime /main/settings/reviewtime /main/settings/output /main/settings/evfmode /main/settings/ownername /main/settings/artist /main/settings/copyright /main/settings/capturetarget /main/settings/capture /main/status/model /main/status/ptpversion /main/status/batterylevel /main/status/lensname /main/status/serialnumber /main/status/shuttercounter /main/status/availableshots /main/imgsettings/imageformat /main/imgsettings/imageformatcf /main/imgsettings/imageformatexthd /main/imgsettings/iso /main/imgsettings/whitebalance /main/imgsettings/whitebalanceadjusta /main/imgsettings/whitebalanceadjustb /main/imgsettings/whitebalancexa /main/imgsettings/whitebalancexb /main/capturesettings/exposurecompensation /main/capturesettings/autoexposuremode /main/capturesettings/drivemode /main/capturesettings/picturestyle /main/capturesettings/shutterspeed /main/capturesettings/meteringmode /main/capturesettings/bracketmode /main/capturesettings/aeb /main/other/d402 /main/other/d407 /main/other/d406 /main/other/d303
Now, we can read out one of these config options, e.g. the shutter count, by running
gphoto2 --get-config /main/status/shuttercounter
which results in
Label: Shutter Counter Type: TEXT Current: 4930
The 4930 fits perfectly to the number of pictures I made with my Canon EOS 7D.