From 5c98eaf5929ed4e2d5b56344e3aa11b7ae596647 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 7 Feb 2023 15:34:42 +0100 Subject: [PATCH] Fix opening Terminal on macOS 13 When Qt Creator is notarized. Using "open" results in a privacy error. A workaround is to use osascript. Unfortunately then the terminal window does not close automatically anymore. Fixes: QTCREATORBUG-28683 Change-Id: I9861d7bd5100fd28b46b774fa465c970758a3a3f Reviewed-by: Marcus Tillmanns Reviewed-by: Reviewed-by: Christian Stenger --- share/qtcreator/scripts/openTerminal.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/scripts/openTerminal.py b/share/qtcreator/scripts/openTerminal.py index 6db94bb258d..c00a51c9b8d 100755 --- a/share/qtcreator/scripts/openTerminal.py +++ b/share/qtcreator/scripts/openTerminal.py @@ -100,7 +100,13 @@ def main(): shell_script.write(commands) shell_script.flush() os.chmod(shell_script.name, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR) - subprocess.call(['/usr/bin/open', '-a', 'Terminal', shell_script.name]) + # TODO /usr/bin/open doesn't work with notarized app in macOS 13, + # use osascript instead (QTCREATORBUG-28683). + # This has the disadvantage that the Terminal windows doesn't close + # automatically anymore. + # subprocess.call(['/usr/bin/open', '-a', 'Terminal', shell_script.name]) + subprocess.call(['/usr/bin/osascript', '-e', 'tell app "Terminal" to activate']) + subprocess.call(['/usr/bin/osascript', '-e', 'tell app "Terminal" to do script "' + shell_script.name + '"']) if __name__ == "__main__": main()