From b7b6bc4373df78da19301f939de047bd5fe07d52 Mon Sep 17 00:00:00 2001
From: Carlos Cordoba <ccordoba12@gmail.com>
Date: Sat, 9 Jan 2021 10:37:32 -0800
Subject: [PATCH] Don't open script that starts Spyder at startup

---
 spyder/app/mainwindow.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
index c86fd840a..6ba6d17cb 100644
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -2806,6 +2806,7 @@ def open_external_file(self, fname):
         Open external files that can be handled either by the Editor or the
         variable explorer inside Spyder.
         """
+        # Check that file exists
         fname = encoding.to_unicode_from_fs(fname)
         if osp.exists(osp.join(CWD, fname)):
             fpath = osp.join(CWD, fname)
@@ -2814,6 +2815,11 @@ def open_external_file(self, fname):
         else:
             return
 
+        # Don't open script that starts Spyder at startup.
+        # Fixes issue spyder-ide/spyder#14483
+        if sys.platform == 'darwin' and 'bin/spyder' in fname:
+            return
+
         if osp.isfile(fpath):
             self.open_file(fpath, external=True)
         elif osp.isdir(fpath):
-- 
2.25.2

