#113 Nikon 5200 - Could not claim the USB device


Hi there I can't get gphoto2 to claim my camera/USB device,

I have the Nikon 5200 connected to my MacBook Pro, I'm using Mac OSX Terminal and gphoto2 version 2.5.4 installed via homebrew.

I run the following to kill any instance of PTPCamera:
killall PTPCamera

I then run the following as proof that the camera is recognized:
gphoto2 --auto-detect

That command results in:

Model Port

Nikon DSC D5200 usb:020,015

However, when I try to capture a photo with:
gphoto2 --capture-image

I get the following error:
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Permission denied).

I've attached a full debug of the error. Any help would be really appreciated.

Tory Brady

1 Attachments


  • you probably do not have permission on the devicenode.

    not sure how macos handles the usb device permissions

    as root it should work

  • Tory

    Actually, sudo gphoto2 -P gives me the same exact error, or sometimes it just hangs.

    This is super disappointing. I had photos working perfectly with my Canon but it was not capable of taking movies. So i returned it and got the Nikon 5200. Now it seems if I want the Nikon to work at all, I'm going to have to switch from Mac to Linux...because usb device permissions on a Mac are a very little known/discussed topic on the internet. I'll see if I can dig anything up.

  • Tory

    I found the solution to my problem. Thanks to the mac-gphoto-enabler script written by Nick Zavaritsky here https://github.com/mejedi/mac-gphoto-enabler.

    After I ran the script I still had to manually kill PTPCamera but after I did that I could access and use the camera via gphoto2 perfectly.

    Marcus, for others convenience I feel section 4.3.9 of the documentation here: http://gphoto.sourceforge.net/doc/manual/permissions-usb.html should reference the github repo for mac-gphoto-enabler if possible.

    Last edit: Tory 2014-07-02
  • I will add something like this:
    If this does not help, and you still get "Could not claim the device" errors,
    try this user supplied tool <ulink url="https://github.com/mejedi/mac-gphoto-enabler">https://github.com/mejedi/mac-gphoto-enabler</ulink>
    which does slightly more intrusive changes to MacOS to avoid it grabbing the camera.