PDA

View Full Version : how to change default qmake path/version in mac os x?



abdol
26th May 2011, 21:51
Hi every one,
How can i change the default path of qmake? I already have it in:
/opt/local/lib
to a newly installed:
/usr/local/trolltech/qt-4.7.3/bin
but I want to change it to the newly installed version. (I don't have qt creator installed)
I am using mac os x and new to Qt.
Thanks,
Abdol

*** To add some explanation, I have 2 installations of Qt, the 2nd one is newer and I want to use the 2nd one by default, and when I type: qt -v in terminal see the 2nd path.

ChrisW67
27th May 2011, 00:17
Set your system path to find the qmake from the new version of Qt before it finds the old version.

abdol
6th June 2011, 22:55
Sorry for the delay,
Thank you for your reply :)
When i search for qmake in:
/opt/local/lib
using terminal, i can't find it and indeed there is no such a file in this directory but why qmake is giving me this path? How can I resolve this?

2nd, I am very new to mac os x, would you please explain what is the system path and how can I set it? can i use "setenv" command?

ChrisW67
6th June 2011, 23:28
"qmake -v" reports where the Qt libraries are installed, not where qmake itself is installed. In your case qmake is probably in /opt/local/bin. Try this:


$ qmake -v
QMake version 2.01a
Using Qt version 4.7.2 in /usr/lib/qt4
$ which qmake
/usr/bin/qmake


How to change your PATH (assumes sh not csh):
http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
for csh the command would be:


setenv PATH "$PATH:/add/my/extra/path"
probably in ~/.cshrc

There are some files in /etc/you can use to change the PATH globally:
http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x

For more specifics you will have to wait until someone that develops on Mac comes along.

abdol
8th June 2011, 18:46
I would like to share what I came to and I still need your help :)

1. How to set global environments variables in mac os x:
http://www.digitaledgesw.com/node/31
http://serverfault.com/questions/16355/how-to-set-global-path-on-os-x/277034#277034
http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x

2. How to change the PATH and order of its entries?
http://www.softec.lu/site/DevelopersCorner/MasteringThePathHelper

to change the variables in qmake i found this:
http://doc.qt.nokia.com/4.7-snapshot/qmake-environment-reference.html
and set the variables to the directories which I have the current installation but there are still multiple entries and when I type qmake -v it is still using the first installation (which is not valid anymore).

I also tried to add the path at the beginning of the PATH but there are still some paths at the beginning that i can not remove or change them.

any idea or help is appreciated.

abdol
8th June 2011, 22:15
when I type qmake -query


QT_INSTALL_BINS:/usr/local/Trolltech/Qt-4.7.3/bin
QT_INSTALL_HEADERS:/usr/local/Trolltech/Qt-4.7.3/include
QT_INSTALL_PREFIX:/usr/local/Trolltech/Qt-4.7.3
QT_INSTALL_PREFIX:/opt/local
QT_INSTALL_DATA:/opt/local/share/qt4
QT_INSTALL_DOCS:/opt/local/share/doc/qt4
QT_INSTALL_HEADERS:/opt/local/include
QT_INSTALL_LIBS:/opt/local/lib
QT_INSTALL_BINS:/opt/local/bin
QT_INSTALL_PLUGINS:/opt/local/share/qt4/plugins
QT_INSTALL_IMPORTS:/opt/local/share/qt4/imports
QT_INSTALL_TRANSLATIONS:/opt/local/share/qt4/translations
QT_INSTALL_CONFIGURATION:/opt/local/etc/qt4
QT_INSTALL_EXAMPLES:/opt/local/share/qt4/examples
QT_INSTALL_DEMOS:/opt/local/share/qt4/demos
QMAKE_MKSPECS:/opt/local/share/qt4/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:4.7.3


and typing echo $PATH gives me:


/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/Trolltech/Qt-4.7.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin

bootchk
5th April 2014, 15:44
If you can't get your path configured the way you want, you could always soft link from the original location of quake binary (for example /usr/bin) to the newer version. If you 'ls -al /usr/bin/q*' you will see that qmake is probably already a soft link.)

Something like:

cd /usr/bin
sudo rm qmake
sudo ln -s /Users/user/Qt/5.1.1/clang_64/bin/qmake qmake

(You will need root permission.)

In other words, the path will still find qmake in its original location, but it will refer to a quake executable in another location.