How to reset push notification permission on macOS

⋅ 2 min read ⋅ macOS Notification

Table of Contents

Problem: Notification permission not reset

When you request permission to use push notifications for the first time on a Mac, the system will present the following dialog asking users to grant permission.

Notification permission dialog.
Notification permission dialog.

Once users choose to allow or deny the permission, their choice will be remembered. They can change their mind in the "System Preferences > Notifications & Focus" menu.

Notifications & Focus.
Notifications & Focus.

During the development, you might want to reset notification permission back to the clean state (UNAuthorizationStatus.notDetermined) to test out every possible scenario for your app.

If you try to remove the app by deleting it from DerivedData and rerunning your app, you will find an unpleasant truth. The user choice is still remembered!

macOS has a different way of resetting push notification permission from how we do in iOS.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

How to reset push notification permission on macOS

  1. Open System Preferences > Notification & Focus
System Preferences.
System Preferences.
  1. Click on the app that you want to reset the Notification permission.
Notifications & Focus.
Notifications & Focus.
  1. Hit the Delete key (⌫ - Backspace/Delete) while your app is highlighted.

And that's all you need to do to reset a push notification permission on macOS.

How to reset push notification permission on macOS (Old way)

I have good and bad news here.

The good news is I have a reliable way to reset notification permission to where it was. The bad news is it is not elegant and involves restarting your Mac :(

To reset a push notification permission in macOS. First, you have to delete your app. To do that:

  1. Make sure your app isn't running in Xcode. If it does, just stop it by select Product > Stop or ⌘ - command + ..
  2. Then, remove the app from DerivedData. You can locate the DerivedData by opening Xcode preferences from the Xcode menu.
Xcode > Preferences... Menu
Xcode > Preferences... Menu

Go to the "Locations" tab. You will find a path to your DerivedData. You can also click the little arrow to jump right to it.

Locations
Locations
  1. You will find a lot of things in that folder. You should find one with a random suffix. Here is mine reset-notification-permission-cxubvioxnwciooapteewxblofwin. Once you find your app, delete it.
  2. Then restart your Mac

And that's all you need to do to reset a push notification permission on macOS.

You can easily support sarunw.com by checking out this sponsor.

Sponsor sarunw.com and reach thousands of iOS developers.

Conclusion

I wish I know a better way to do this, but this is the only way I know right now. If you happen to know a better way, please let me know. You can contact me via Twitter. My DM is always open.


Read more article about macOS, Notification, or see all available topic

Enjoy the read?

If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you'll get a quick recap of all articles and tips posted on this site. No strings attached. Unsubscribe anytime.

Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.

If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.

Become a patron Buy me a coffee Tweet Share
Previous
How to remove a DEBUG banner in Flutter App

When you run a Flutter app for the first time, you probably notice a debug banner in the upper right of the screen. Learn what it is and how to remove it.

Next
What is the iOS version global market share

Find out where we can get information about the iOS version market share.

← Home