Jeffrey
Jeffrey

Reputation: 4506

How to check the installed Qt version on Mac OS X

Is there a command to check the version of the installed Qt on Mac OS X. My Mac OS X version is 10.6.7.

Eidt: Update the status 10/28/2011

When running /usr/sbin/system_profiler SPFrameworksDataType, the version of the QTkit is 7.6.6.

The value of the macro QT_VERSION_STR in qglobal.h is "4.7.2".

I'm confused why the two version strings are different? Obviously, the version string "4.7.2" is what I want.

Thanks, Jeffrey

Upvotes: 18

Views: 31641

Answers (7)

bleater
bleater

Reputation: 5499

If installed via brew, this will get the version into the variable QT_VERSION

QT_VERSION=`brew list --versions qt5 | sed -En -e 's/qt ([0-9._]+).*/\1/p'`

You can then invoke it thusly:

/usr/local/Cellar/qt/${QT_VERSION}/bin/qmake

Upvotes: 1

Thiago Gouvea
Thiago Gouvea

Reputation: 594

On terminal:

qmake -v

It should return versions of QMake and Qt.

Something like:

QMake version 3.0

Using Qt version 5.6.2 in /Users/thiago/anaconda/lib

Upvotes: 10

user4513271
user4513271

Reputation:

If you installed with brew, just do...

brew info qt or brew info qt5

Update:

Doing it this way will cut out all the extra stuff and only show versions.

brew list --versions qt or brew list --versions qt5

Here's a nice cheatsheet for brew, btw: http://ricostacruz.com/cheatsheets/homebrew.html

Upvotes: 17

PopcornKing
PopcornKing

Reputation: 1380

cd to the include directory where your qt headers are located and then...

grep --include=\*.h -rnw ./ -e "QT_VERSION_STR"

which should output something like...

./QtCore/qglobal.h:40:#define QT_VERSION_STR "5.4.2"

Upvotes: 1

Erik
Erik

Reputation: 3777

Go to your "Applications>>Tools" folder and launch the System-Profiler. Look at "Software>>Frameworks>>QTKit". There you will find the version.

To get in in a terminal (to use it from Java for example) execute the following command:

  /usr/sbin/system_profiler SPFrameworksDataType

There you will find something like this:

  QTKit:

    Version: 7.7
    Last Modified: 13.04.11 16:02
    Kind: Universal
    64-Bit (Intel): Yes
    Get Info String: QTKit 7.7, Copyright 2003-2011, Apple Inc.
    Location: /System/Library/Frameworks/QTKit.framework
    Private: No

In XCode there should be an environment-variable available.

Upvotes: 14

Robin
Robin

Reputation: 1698

IF you speak about programming here...: At compile time you can check Qt's version with QT_VERSION_STR. During runtime you can use qVersion(). Obviously, the version you build you application with does not always match the version you run it with.

Upvotes: 8

Tom Anderson
Tom Anderson

Reputation: 47213

If you can find where Qt's headers are installed, qglobal.h contains a define for QT_VERSION_STR. You can simply grep for that.

Upvotes: 2

Related Questions