Is there an easy way to print the GTK and QT versions installed on a system? I am wanting to make a script that will print the version numbers of various developer tools and libraries.


Ask pkg-config.

$ pkg-config --modversion gtk+-2.0
  • It would be good that it also handle if libraries aren't installed.
    – Braiam
    Jul 6 '13 at 23:50
  • Using pkg-config on a non-existent .pc file results in a non-zero return code. Jul 6 '13 at 23:51
  • I am writing the code like this (pkg-config --modversion gtk+-3.0 2>/dev/null || echo "GTK3 is not installed") Jul 6 '13 at 23:52
  • @IgnacioVazquez-Abrams, thanks. This command is excellent. Jul 6 '13 at 23:52
  • If you're only testing for presence and not the specific version then you don't need to pass --modversion. Jul 6 '13 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.