Raspbian Stretch and GPIO Utility Fix

If any of you have installed the new “Stretch” version of Raspbian on the Raspberry Pi, you may have noticed a slight issue with the wiringPi GPIO utility.

gpio i2cd

will complain of a missing i2cdetect even though it is actually there

which i2cdetect

Well, here’s a fix:

The problem: When searching for i2c devices, you might use “gpio i2cd” which merely calls i2cdetect with the right parameters for the Raspberry Pi. Well, except it doesn’t. Apparently that has been the case since December 2016 – I was the first to report it and this will be fixed soon. In the meantime, if you have this problem, here’s the fix – and thanks due to Gordon Henderson (I did this as PI user in the PI directory):

Firstly – remove wiringPi

sudo apt-get purge wiringPi

Grab the source

git clone git://git.drogon.net/wiringPi

compile it….

cd wiringPi


hash -r
gpio -v

and assuming all is ok, fix the bug:

cd gpio
nano gpio.c

Around line 59 you should see this:

#define I2CDETECT "/usr/sbin/i2cdetect"

change it to:

#define I2CDETECT "/i2cdetect"

Recompile and install

sudo make install

and test

gpio i2cd

All done!


6 thoughts on “Raspbian Stretch and GPIO Utility Fix

  1. Make a symbolic link at /usr/sbin/i2cdetect pointed at the real executable at /i2cdetect:

    ln -s /i2cdetect /usr/sbin/i2cdetect

    ...and the unmodified "gpio" code should now be able to find it.

    More information about symlinks:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.