diff --git a/src/plugins/debugger/debuggerconstants.h b/src/plugins/debugger/debuggerconstants.h
index 53874f23cc0a48d00f4e0948c420be28f58a564b..6640b4033d5f78943e0a1a3e31c9a971847ca540 100644
--- a/src/plugins/debugger/debuggerconstants.h
+++ b/src/plugins/debugger/debuggerconstants.h
@@ -57,6 +57,12 @@ const char * const DEBUGGER_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("Debugger", "D
 
 namespace Internal {
     enum { debug = 0 };
+#ifdef Q_OS_MAC
+    const char * const LD_PRELOAD_ENV_VAR = "DYLD_INSERT_LIBRARIES";
+#else
+    const char * const LD_PRELOAD_ENV_VAR = "LD_PRELOAD";
+#endif
+
 }
 } // namespace Constants
 
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 6c6c307bede2e1ba0d27f7f6c7b9f1746e236401..8a787fa5fcf633494494787d5a2d2e3361e2b772 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -4328,7 +4328,10 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &gdb, const QStr
     }
     if (m_gdbAdapter->dumperHandling() == AbstractGdbAdapter::DumperLoadedByGdbPreload
         && checkDebuggingHelpers()) {        
-        const QString cmd = QLatin1String("set environment LD_PRELOAD ") + manager()->qtDumperLibraryName();
+        QString cmd = _("set environment ");
+        cmd += _(Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR);
+        cmd += _c(' ');
+        cmd += manager()->qtDumperLibraryName();
         postCommand(cmd);
         m_debuggingHelperState = DebuggingHelperLoadTried;
     }
diff --git a/src/plugins/debugger/gdb/termgdbadapter.cpp b/src/plugins/debugger/gdb/termgdbadapter.cpp
index 19de9ffa06777a79c81b0a767c0d878d8c43b0d2..5461d175bf23069f2f3fa1f6ebd6b43803d1635f 100644
--- a/src/plugins/debugger/gdb/termgdbadapter.cpp
+++ b/src/plugins/debugger/gdb/termgdbadapter.cpp
@@ -95,7 +95,10 @@ void TermGdbAdapter::startAdapter()
     QStringList environment = startParameters().environment;
     if (dumperHandling() == DumperLoadedByGdbPreload
         && m_engine->checkDebuggingHelpers()) {
-        environment.push_back(QLatin1String("LD_PRELOAD=") + m_engine->qtDumperLibraryName());        
+        QString var = QLatin1String(Debugger::Constants::Internal::LD_PRELOAD_ENV_VAR);
+        var += QLatin1Char('=');
+        var += m_engine->qtDumperLibraryName();
+        environment.push_back(var);
         m_engine->setDebuggingHelperState(DebuggingHelperLoadTried);
     }
     m_stubProc.setEnvironment(environment);