diff --git a/libgui/src/octave-qobject.cc b/libgui/src/octave-qobject.cc
--- a/libgui/src/octave-qobject.cc
+++ b/libgui/src/octave-qobject.cc
@@ -37,16 +37,22 @@ along with Octave; see the file COPYING.
 #include "dialog.h"
 #include "interpreter-qobject.h"
 #include "main-window.h"
 #include "octave-qobject.h"
 #include "qt-application.h"
 #include "qt-interpreter-events.h"
 #include "resource-manager.h"
 
+#if defined (Q_OS_MAC)
+// ObjC interface is needed for App Nap control
+#include <objc/runtime.h>
+#include <objc/message.h>
+#endif
+
 #include "oct-env.h"
 #include "version.h"
 
 #include "ovl.h"
 
 namespace octave
 {
   // Disable all Qt messages by default.
@@ -128,16 +134,22 @@ namespace octave
 
     QCoreApplication::setApplicationName ("GNU Octave");
     QCoreApplication::setApplicationVersion (OCTAVE_VERSION);
 
     // Register octave_value_list for connecting thread crossing signals.
 
     qRegisterMetaType<octave_value_list> ("octave_value_list");
 
+#if defined (Q_OS_MAC)
+    // App Nap causes pause() and sleep() to misbehave. Disable it
+    // for the entire program run.
+    disable_app_nap ();
+#endif
+
     // Force left-to-right alignment (see bug #46204)
     m_qapplication->setLayoutDirection (Qt::LeftToRight);
 
     connect_uiwidget_links ();
 
     connect (m_interpreter_qobj, SIGNAL (octave_finished_signal (int)),
              this, SLOT (handle_octave_finished (int)));
 
@@ -169,16 +181,58 @@ namespace octave
     delete m_qsci_tr;
     delete m_gui_tr;
     delete m_qt_tr;
     delete m_qapplication;
 
     string_vector::delete_c_str_vec (m_argv);
   }
 
+#if defined (Q_OS_MAC)
+  void base_qobject::disable_app_nap (void)
+  {
+    Class process_info_class;
+    SEL process_info_selector;
+    SEL begin_activity_with_options_selector;
+    id process_info;
+    id reason_string;
+
+    // Option codes found at https://stackoverflow.com/questions/22784886/what-can-make-nanosleep-drift-with-exactly-10-sec-on-mac-os-x-10-9/32729281#32729281
+    unsigned long long NSActivityUserInitiatedAllowingIdleSystemSleep = 0x00FFFFFFULL;
+    unsigned long long NSActivityLatencyCritical = 0xFF00000000ULL;
+
+    // Avoid errors on older versions of OS X
+    process_info_class = (Class) objc_getClass ("NSProcessInfo");
+    if (process_info_class == nil)
+      return;
+    process_info_selector = sel_getUid ("processInfo");
+    if (class_getClassMethod (process_info_class, process_info_selector) == NULL)
+      return;
+    begin_activity_with_options_selector = sel_getUid ("beginActivityWithOptions:reason:");
+    if (class_getInstanceMethod (process_info_class,
+        begin_activity_with_options_selector) == NULL)
+      return;
+
+    if ((process_info = objc_msgSend ((id)process_info_class, process_info_selector)) == nil)
+      return;
+
+    reason_string = objc_msgSend (objc_getClass ("NSString"), sel_getUid ("alloc"));
+    reason_string = objc_msgSend (reason_string, sel_getUid ("initWithUTF8String:"),
+        "App Nap causes pause() malfunction");
+
+    // Start an Activity that suppresses App Nap. This Activity will
+    // run for the entire duration of the Octave process. This is intentional,
+    // not a leak.
+    osx_latencycritical_activity = objc_msgSend (process_info,
+        begin_activity_with_options_selector,
+        NSActivityUserInitiatedAllowingIdleSystemSleep | NSActivityLatencyCritical,
+        reason_string);
+  }
+#endif
+
   void base_qobject::config_translators (void)
   {
     if (m_translators_installed)
       return;
 
     resource_manager::config_translators (m_qt_tr, m_qsci_tr, m_gui_tr);
 
     m_qapplication->installTranslator (m_qt_tr);
diff --git a/libgui/src/octave-qobject.h b/libgui/src/octave-qobject.h
--- a/libgui/src/octave-qobject.h
+++ b/libgui/src/octave-qobject.h
@@ -99,16 +99,22 @@ namespace octave
 
     interpreter_qobject * interpreter_qobj (void)
     {
       return m_interpreter_qobj;
     }
 
     QThread *main_thread (void) { return m_main_thread; }
 
+  private:
+
+#if defined (Q_OS_MAC)
+    void disable_app_nap (void);
+#endif
+
   public slots:
 
     void handle_octave_finished (int);
 
     virtual void confirm_shutdown_octave (void);
 
     void copy_image_to_clipboard (const QString& file, bool remove_file);
 
