How do I disable private browsing in Safari

Solution 1:

I could suggest something more evil :

Enable parental controls and use the logs !

Someone on Apple Support asked if private browsing disabled logging. It appears no, the parents controls will still log the websites. Even if the sneaky kids enable the private browsing, the logs will spill the beans !

Solution 2:

If logging isn't practical or you want to be more proactive and prevent Private Browsing from being accessible in the first place, it is possible (though not a short process) to disable Private Browsing if you are willing to mess with Safari's internal files.

Note that macOS 10.12+ will not allow you to modify, overwrite, or delete Safari. You can make the following modifications to a copy of Safari and put that version in the Dock, but the original Safari will still need to exist in the Applications folder.

Install the necessary files

  1. Install Xcode (available in the App Store)
  2. Download a zip file of Nib-Decompiler from GitHub (or clone the repository if you know how to do that)
  3. Open the NibDecompiler.xcodeproj Xcode project in Xcode
  4. Compile the project. This will produce a file named NibDecompiler.action. You can now close the project.
  5. Copy NibDecompiler.action into ~/Library/Automator*
  6. From your download, copy NibDecompiler.workflow into ~/Library/Services*

Remove the "New Private Window" option from the menu bar

Note that this involves editing the Safari internal files. You will need to redo these steps every time you update Safari.

  1. Go to Safari in the Finder and right-click "Show Package Contents"
  2. This will open the app as if it were a folder. Go to Contents, then Resources, then Base.lproj folder.
  3. Find MainMenu.nib. Copy it outside of the package somewhere (like the Desktop).
  4. Right-click on the file and choose "NibDecompiler". The file will be made editable.
  5. Open the file in Xcode (should be double-clickable)
  6. In the window with the Safari menu, choose "Safari" to expand it.
  7. Click on the "New Private Window" menu item.
  8. Hit the delete key to see it disappear.
  9. Save the file.
  10. Back in the Base.lproj folder of the Safari app, make a copy MainMenu.nib just in case something goes wrong and you need to restore it.
  11. Copy your edited MainMenu.nib to Base.lproj, overwriting the existing one.
  12. Open Safari to make sure that it still opens (if it doesn't, restore your original MainMenu.nib file).
  13. (Optional) If everything works, you may delete the backup MainMenu.nib if you so choose.

By removing the "New Private Window" menu item from the menu bar, they will not be able to enter private browsing. Additionally, keyboard shortcuts are tied to menu items, so that's disabled too.


* ~ means your user home directory. Library is a hidden folder that isn't visible when you navigate to the home directory. You can get to this folder in the Finder by going to the "Go" menu and choosing "Connect to Folder…", then typing in ~/Library. You will then see the folders you need to copy files to.

Instructions copied from this MacRumors forum thread, updated for Safari 9 in this post.