diff --git generator/generator.pri generator/generator.pri
index daa3e0c..3b62b9b 100644
--- generator/generator.pri
+++ generator/generator.pri
@@ -5,6 +5,12 @@ TEMPLATE = app
 TARGET = generator
 DEPENDPATH += $$GENERATORPATH tests parser
 mac:CONFIG -= app_bundle
+
+LIBS *= -L@PREFIX@/lib
+INCLUDEPATH += @QT_INCLUDES_DIR@
+INCLUDEPATH += @PREFIX@/include/phonon
+INCLUDEPATH += @PREFIX@/include
+
 INCLUDEPATH += $$GENERATORPATH/.
 INCLUDEPATH += $$GENERATORPATH/../common
 
diff --git generator/main.h generator/main.h
index ebf153d..dd65632 100644
--- generator/main.h
+++ generator/main.h
@@ -46,6 +46,7 @@
 
 #include <QFile>
 #include <QDir>
+#include <QDebug>
 
 struct Preprocess
 {
@@ -87,17 +88,24 @@ struct Preprocess
             includes += commandLineIncludes.split(path_splitter);        
 
         // Include Qt
+        qDebug() << "includes=" << includes;
         QString qtdir = getenv ("QTDIR");
         if (qtdir.isEmpty()) {
 #if defined(Q_OS_MAC)
             qWarning("QTDIR environment variable not set. Assuming standard binary install using frameworks.");
-            QString frameworkDir = "/Library/Frameworks";
+            QString frameworkDir = getenv("QTFRAMEWORKS");
+            if (frameworkDir.isEmpty()) {
+                frameworkDir = "@QT_FRAMEWORKS_DIR@";
+            }
             includes << (frameworkDir + "/QtXml.framework/Headers");
             includes << (frameworkDir + "/QtNetwork.framework/Headers");
             includes << (frameworkDir + "/QtCore.framework/Headers");
             includes << (frameworkDir + "/QtGui.framework/Headers");
             includes << (frameworkDir + "/QtOpenGL.framework/Headers");
             includes << frameworkDir;
+            includes << "@QT_INCLUDES_DIR@";
+            includes << "@PREFIX@/include/phonon";
+            includes << "@PREFIX@/include";
 #else
             qWarning("QTDIR environment variable not set. This may cause problems with finding the necessary include files.");
 #endif
@@ -110,6 +118,7 @@ struct Preprocess
             includes << (qtdir + "/QtOpenGL");
             includes << qtdir;
         }
+        qDebug() << "includes=" << includes;
 
         foreach (QString include, includes)
             preprocess.push_include_path(QDir::convertSeparators(include).toStdString());        
diff --git qtbindings/qtbindingsbase.pri qtbindings/qtbindingsbase.pri
index 54eb9a5..3021b73 100644
--- qtbindings/qtbindingsbase.pri
+++ qtbindings/qtbindingsbase.pri
@@ -1,9 +1,12 @@
 TEMPLATE = lib
 DEPENDPATH += .
 INCLUDEPATH += .
+INCLUDEPATH += @QT_INCLUDES_DIR@
+INCLUDEPATH += @PREFIX@/include/phonon
+INCLUDEPATH += @PREFIX@/include
 DESTDIR = $$PWD/../plugins/script
 QT += script
 CONFIG += @ARCHES@ @BUILD_TYPE@
 GENERATEDCPP = $$PWD/../generated_cpp
 TARGET=$$qtLibraryTarget($$TARGET)
 target.path = $$[QT_INSTALL_PLUGINS]/script
