Removing all installed OpenCV libs

If you have the build directory then it is recommended to execute:

 $ sudo make uninstall

from the build directory as per @Navid 's answer

But this will leave few .so* files somewhere

To completely remove all such files, do:

$ sudo rm /usr/local/{bin,lib}/*opencv* 

/usr/local is what we normally set CMAKE_INSTALL_PREFIX to while running cmake. Replace it according to how you executed cmake


By default, when building OpenCV from source, it will place it's output in /usr/local/lib and /usr/local/bin. Although, judging from your error messages, it looks like it placed the libraries in /usr/lib and the binaries in /usr/bin, so you might also check in there.

You can also use the Linux find command. So, to find all OpenCV libraries you can do the following (this might take a while):

$> sudo find / -name "*opencv*" -exec rm -i {} \;

The above command will find any file containing opencv in the name, and will prompt you to remove it. As always, be careful when deleting things manually!

Another option might be to manually compile OpenCV again (exactly as you did before), make install to create the install manifest, and then try make uninstall to see if it will clean up itself.

Hope that helps! :)


You can do a sudo make uninstall for a clean uninstall