Reason: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
First of all, this is not a tutorial. Today I just faced another issue with my MacOS while working in Python.
I got this warning message: ” WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. ”
I am using MacOS Sonoma 14.5
Update: I just updated my macOS 14 to macOS 15 sequoia developer beta and the warning message is no more.
I was trying to run a Tkinter program in Python with Visual Studio code and got this message. However, it did not affect my program output at all as this is only a warning and not an error.
Here is my screenshot of the console:
Then I searched over the internet and found that a lot of people are facing the same warning but in different aspects.
So it is confirmed that this is not an issue of Tkinter directly.
When I run the program, it opens a new native window that uses native MacOS components.
This error can be found while running codes that will actually open a new prompt or window or an IDE or environment that is connected with a MacOS component.
I have worked on SwiftUI to build iOS apps also and seeing the message I can clearly say that the warning message is coming through the core OS and not from Python or any other third-party objects. This part ” NSApplicationDelegate.applicationSupportsSecureRestorableState ” is a Swift or objective C thing.
We can get the same warning while working on JavaFX or Unreal Engine as well.
How to fix it:
Do not rush to fix it as long it is not affecting your program execution.
It can be fixed if Python or JavaFX whatever you are using gives a specific update for MacOS, or you can also wait for a MacOS update. We can hope, it will be fixed soon.
There is a solution right now to remove the warning but I will not recommend that.
The solution is different for each of the aspects. For example, if you are using Python you can use this at the beginning of your Code:
import os import sys # Redirect stderr to /dev/null to suppress macOS specific warnings sys.stderr = open(os.devnull, 'w')
But it needs a lot of permission on OS level to modify the actual files. So not sure if its gonna work or not for everyone.
Or go to the official Python website and download the latest Python version for MacOS 64 bit universal installer.
You can also check my YouTube video on this:
Leave a Reply