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
- Install Xcode (available in the App Store)
- Download a zip file of Nib-Decompiler from GitHub (or clone the repository if you know how to do that)
- Open the
NibDecompiler.xcodeproj
Xcode project in Xcode - Compile the project. This will produce a file named
NibDecompiler.action
. You can now close the project. - Copy
NibDecompiler.action
into~/Library/Automator
* - 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.
- Go to Safari in the Finder and right-click "Show Package Contents"
- This will open the app as if it were a folder. Go to Contents, then Resources, then Base.lproj folder.
- Find
MainMenu.nib
. Copy it outside of the package somewhere (like the Desktop). - Right-click on the file and choose "NibDecompiler". The file will be made editable.
- Open the file in Xcode (should be double-clickable)
- In the window with the Safari menu, choose "Safari" to expand it.
- Click on the "New Private Window" menu item.
- Hit the delete key to see it disappear.
- Save the file.
- Back in the
Base.lproj
folder of the Safari app, make a copyMainMenu.nib
just in case something goes wrong and you need to restore it. - Copy your edited
MainMenu.nib
toBase.lproj
, overwriting the existing one. - Open Safari to make sure that it still opens (if it doesn't, restore your original
MainMenu.nib
file). -
(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.