10

For Mac OS X, how do you disable Incognito mode in Chrome? The desired result simply being that the user cannot browse in Incognito mode, even if they know the keyboard shortcut or something similar.

  • What does "disable" mean to you? Rip out the code? Change the keyboard shortcut? Recompile it to always be cognito? Something else? (Since you've already answered - it's somewhat clear what you are asking - just a reason for someone to down vote I suppose...) – bmike Aug 18 '15 at 19:37

4 Answers4

14

The short answer: you must edit the preferences file so that the key IncognitoModeAvailability has a value of 1.

Original Instructions

In /Library/Preferences/ add a plist entry to the file com.google.Chrome.plist such that the key is IncognitoModeAvailability and the value is 1.

Here is an example: assuming the file com.google.Chrome.plist doesn't exist, use a text editor to save the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>IncognitoModeAvailability</key>
   <integer>1</integer>
</dict>
</plist>

The full file name and path of the above should be /Library/Preferences/com.google.Chrome.plist.

Updated Instructions

Since macOS Sierra, proper plist files seem to be in some binary format by default—a format that you can't edit with a normal text editor. I found that I can open them in Apple's Xcode and it has a nice GUI—very easy to edit. If you don't have access to Xcode, I think you can use the plutil terminal command like this:

plutil -convert xml1 YOUR_FILE_NAME_HERE

In xml format, you should be able to edit it in a text editor, and a web site I read says that the xml format should work fine.

Regardless, I recently was able to disable Incognito mode using Xcode on the ~/Library/Preferences/com.google.Chrome.plist file. (Furthermore, I had to delete /Library/Preferences/com.google.Chrome.plist because my old version was deemed "corrupted" because it wasn't in a proper file format.)

  • @user26270 If you are on OS X 10.11, there is a new security feature that prevents you from editing files in /Library. You can turn off SIP and then edit the file and it will work. Also, I haven't tested this, but if you put the file in ~/Library, maybe it will work. – Joseph Hansen Nov 19 '15 at 20:56
  • 1
    /Library/Preferences is not protected by SIP (would be kind of pointless anyway) – nohillside Nov 19 '15 at 21:09
  • I'm on OS X 10.10.5. I couldn't edit the plist in a text file, had to do it through XCode. And it still didn't disable Incognito mode. – user26270 Nov 19 '15 at 21:41
  • Hmm, well it's working great on a few machines I've seen or worked on. Maybe check spelling and capitalization on IncognitoModeAvailability and check that you don't have multiple installs of Chrome (maybe one local and another one). – Joseph Hansen Nov 20 '15 at 03:51
  • It is working after all. Maybe I just had to restart, which I thought I did before commenting that it wasn't working. I've upvoted the answer and deleted my comment saying it wasn't working. – user26270 Nov 23 '15 at 16:48
  • WORKED FOR ME, i'm using Capitan 10.11.3, create the file the file using TextEdit and save to desktop. (Make sure the name is correct!) Then using Finder I drag/drop to /Library/Preferences. But I had to first "Show Library" using right click. It was NOT necessary to disable SIP. – John Henckel Apr 24 '16 at 15:26
  • This is very helpful in concert with e.g. the StayFocusd plugin to put more armor plating on against time-wasting websites, which is otherwise trivial. – BaseZen Nov 23 '16 at 20:51
  • @BaseZen If you want an amazing app a la StayFocusd, check out a new one I'm using: http://freedom.to – Joseph Hansen Nov 23 '16 at 20:58
  • You can also just run defaults read <filename>.plist if you don't want to worry about rebooting. – Michael Mior Jul 01 '20 at 15:18
5

Rather than converting the plist and manually editing it, you can set the option in one step. In the Terminal, run:

defaults write com.google.chrome IncognitoModeAvailability -integer 1

Then reboot or run:

killall cfprefsd

to reload the plist cache. It is not enough to quit and relaunch Chrome, or even to logout and login again.

IncognitoModeAvailability can be set to 0, 1, or 2:

  • 0 means Incognito is enabled
  • 1 means Incognito is disabled
  • 2 means Incognito is forced
  • The killall really is key (I was looking to re-enable). Strangely no chatbot can answer this simple question – NelsonGon Feb 18 '24 at 00:20
2

Here's an updated way for macOS Sierra.

  1. Install a plist editing program like PrefSetter.
  2. Using Finder, go to the ~/Library/Preferences/ folder.
  3. Copy and paste an existing plist file, (I used com.google.Keystone.agent.plist).
  4. Now open that copied file using PrefSetter, and rename it com.google.Chrome.
  5. Delete all existing keys, and create a new key, giving it the name: IncognitoModeAvailability.
  6. Under class, choose Integer, and under value, enter 1.
  7. Now save this file, and copy and paste it into the /Library/Preferences folder as well. (Remember this isn't the same folder as ~/Library/Preferences folder)
  8. Restart your computer, and viola, it should work!
  • On Mojave here. Does 1 mean to disable? So 0 means to enable? Which sounds very backwards. – Jonny Jan 30 '19 at 05:29
  • Checked https://www.chromium.org/administrators/policy-list-3#IncognitoModeAvailability which also says 0 would mean incognito mode enabled, 1 is incognito mode disabled. Mine is disabled for some reason but setting it to 0 and restarting does not help. Set that in both ~/Library/Preferences/com.google.Chrome.plist and /Library/Preferences/com.google.Chrome.plist. – Jonny Jan 30 '19 at 05:41
  • ^ Turned out I was connected to a network where that value is forced to 1. You can find the forced policies at this url in chrome: chrome://policy/ – Jonny Jan 30 '19 at 05:48
0

I've seen a bunch of very complicated directions/suggestions for how to disable Incognito in Google Chrome for Mac OS X, but I've found a much simpler method.

Simply open up Chrome, click on "Chrome" in the upper-left hand corner; click on "Preferences"; click on "Settings"; scroll to the very bottom and click on "Show Advanced Settings"; scroll to the very bottom and click on "Reset Settings." Voila! But, now your settings are at their original settings, so you'll now have to go and reset those settings that you want to change from their original state.

grg
  • 201,078
Bruin
  • 11
  • 1