diff --git a/qtbase/src/corelib/global/global.pri b/qtbase/src/corelib/global/global.pri
index f74662b..82f709c 100644
--- a/qtbase/src/corelib/global/global.pri
+++ b/qtbase/src/corelib/global/global.pri
@@ -32,6 +32,9 @@ SOURCES += \
 
 VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
 
+OBJECTIVE_SOURCES += global/qtmessagebox.mm
+LIBS += -framework AppKit
+
 # qlibraryinfo.cpp includes qconfig.cpp
 INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
 
diff --git a/qtbase/src/corelib/global/qlogging.cpp b/qtbase/src/corelib/global/qlogging.cpp
index 6984097..2993e1b 100644
--- a/qtbase/src/corelib/global/qlogging.cpp
+++ b/qtbase/src/corelib/global/qlogging.cpp
@@ -1657,6 +1657,15 @@ static void qt_message_print(QtMsgType msgType, const QMessageLogContext &contex
         ungrabMessageHandler();
     } else {
         fprintf(stderr, "%s\n", message.toLocal8Bit().constData());
+        if (context.file) {
+            fprintf(stderr, "\t%s:%d\n", context.file, context.line);
+        }
+        if (context.function) {
+            fprintf(stderr, "\tfunction=%s\n", context.function);
+        }
+        if (context.category && strcasecmp(context.category, "default")) {
+            fprintf(stderr, "\tcategory=%s\n", context.category);
+        }
     }
 }
 
@@ -1679,6 +1688,23 @@ static void qt_message_fatal(QtMsgType, const QMessageLogContext &context, const
         return; // ignore
     else if (ret == 1)
         _CrtDbgBreak();
+#elif defined(Q_OS_OSX) && !defined(QT_BOOTSTRAPPED)
+    QString contextBuf = message;
+    extern int qt_fatal_message_box(const QString&, const QString&);
+    if (context.file) {
+        contextBuf += QString::fromLatin1("\n") + QString::fromLatin1(context.file) + QString::fromLatin1(":") + QString::number(context.line);
+    }
+    if (context.function) {
+        contextBuf += QString::fromLatin1("\nfunction=") + QString::fromLatin1(context.function);
+    }
+    if (context.category && strcasecmp(context.category, "default")) {
+        contextBuf += QString::fromLatin1("\ncategory=") + QString::fromLatin1(context.category);
+    }
+    if (qt_fatal_message_box("Qt fatal error", contextBuf)) {
+        abort();
+    } else {
+        exit(1);
+    }
 #else
     Q_UNUSED(context);
     Q_UNUSED(message);
diff --git a/qtbase/src/corelib/global/qtmessagebox.mm b/qtbase/src/corelib/global/qtmessagebox.mm
new file mode 100644
index 0000000..dda7cae
--- /dev/null
+++ b/qtbase/src/corelib/global/qtmessagebox.mm
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 René J.V. Bertin <rjvbertin@gmail.com>
+**
+** This file is an extension of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <Cocoa/Cocoa.h>
+#include <AppKit/AppKit.h>
+
+#include "qstring.h"
+
+#include <dlfcn.h>
+
+class AutoReleasePool
+{
+public:
+    AutoReleasePool(): pool([[NSAutoreleasePool alloc] init]) {}
+    ~AutoReleasePool() { [pool drain]; }
+
+private:
+    NSAutoreleasePool *pool;
+};
+
+int qt_fatal_message_box( const QString &title, const QString &message )
+{
+    int (*_CGSDefaultConnection_p)();
+    _CGSDefaultConnection_p = (int (*)()) dlsym(RTLD_DEFAULT, "_CGSDefaultConnection");
+    if (!_CGSDefaultConnection_p) {
+        NSLog(@"qt_fatal_message_box(%@,%@): couldn't load _CGSDefaultConnection: %s",
+            [NSString stringWithCString:message.toUtf8() encoding:NSUTF8StringEncoding],
+            [NSString stringWithCString:title.toUtf8() encoding:NSUTF8StringEncoding], dlerror());
+    }
+    if (_CGSDefaultConnection_p && (*_CGSDefaultConnection_p)()) {
+        AutoReleasePool pool;
+        NSAlert* alert = [[[NSAlert alloc] init] autorelease];
+        NSString *msg, *tit;
+        @synchronized([NSAlert class]){
+            [alert addButtonWithTitle:@"Exit"];
+            [alert addButtonWithTitle:@"Abort"];
+            [alert setAlertStyle:NSCriticalAlertStyle];
+            [alert setMessageText:@"" ];
+            if( !(msg = [NSString stringWithCString:message.toUtf8() encoding:NSUTF8StringEncoding]) ){
+              msg = [NSString stringWithCString:message.toLatin1() encoding:NSASCIIStringEncoding];
+            }
+            if( !(tit = [NSString stringWithCString:title.toUtf8() encoding:NSUTF8StringEncoding]) ){
+              tit = [NSString stringWithCString:title.toLatin1() encoding:NSASCIIStringEncoding];
+            }
+            if( msg ){
+              [alert setInformativeText:msg];
+            }
+            else{
+              NSLog( @"msg=%@ tit=%@", msg, tit );
+            }
+            [[alert window] setTitle:tit];
+            return NSAlertSecondButtonReturn == [alert runModal];
+        }
+    }
+    return 0;
+}
