Safari Developer Menu Disabled

Solution 1:

Testing under a fully updated macOS Mojave 10.14.6 with Safari 13.1.2 when toggling the Show Develop menu in menu bar checkbox at Safari > Preferences… > Advanced, there are two PLIST files that get modified. One file having one key modified and the other file having three keys modified, i.e.:

  • ~/Library/Preferences/com.apple.Safari.SandboxBroker.plist
    • ShowDevelopMenu
  • ~/Library/Containers/com.apple.Safari/Data/Library/Preferences/com.apple.Safari.plist
    • IncludeDevelopMenu
    • WebKitDeveloperExtrasEnabledPreferenceKey
    • WebKitPreferences.developerExtrasEnabled

The value of all four of these keys are a boolean, and when the Show Develop menu in menu bar checkbox is checked, the value is yes, true or 1 depending on how one is reading the settings.

In Terminal the defaults read ... command will return 1 or 0, or if the key isn't present it errors out with a message.

The example shell script code, further below, was tested and works under normal circumstances, however, it may not work on an inactive Show Develop menu in menu bar checkbox. That said, you really have nothing to loose but a few minutes of time giving it a try.

Notes:

  • Important! In order for this example shell script to work you'll need to, at least temporarily, add Terminal to System Preferences > Security & Privacy > Privacy > Full Disk Access, and Terminal should be closed when you do.
  • When the example shell script is run, Safari should be closed as well, however, as coded it will close it if it's open. It will also open it after the changes have been made.
  • Because of other OS security measures, (sandboxing), the com.apple.Safari.plist file needs be copied to /tmp/, modified there, and then moved back. The shell script, as coded, handles this. The com.apple.Safari.SandboxBroker.plist file is modified in place.
  • As coded, the two PLIST files get backed up with a .bak extension, however the shell script can only be run one time unless the n is removed from cp -avn for both files, which will then overwrite the original backups!
  • As coded, it will output debugging information (set -x) and this is in case you have an issue you can copy and paste the output from Terminal for troubleshooting if need be. So, if there is an issue, do not close the window until it's copied and pasted elsewhere so I can see it.

To use the example shell script code:

  1. Open Terminal and run the following compound command:

    touch sdmcb; chmod u+x sdmcb; open -e sdmcb
    
  2. Copy and paste the example shell script code into the opened sdmcb document, then save and close it.

  3. Back in Terminal use the following command to run the shell script:

    ./sdmcb
    

That's it, this will either work or it won't, it's the only thing I can think of trying, sans booting to macOS Recovery and deleting the two PLIST files which may remove a setting that's causing it to be inactive to begin with, if it's even in those two files.


Example shell script code:

#!/bin/bash

set -e
set -x

[[ $(ps x | grep '[S]afari.app') == ""  ]] || killall Safari; sleep 2
cd "$HOME/Library/Containers/com.apple.Safari/Data/Library/Preferences/" || exit
cp -v 'com.apple.Safari.plist' '/tmp/' || exit
cp -avn 'com.apple.Safari.plist' 'com.apple.Safari.plist.bak' || exit
defaults write '/tmp/com.apple.Safari.plist' "IncludeDevelopMenu" -bool 'yes'
defaults write '/tmp/com.apple.Safari.plist' "WebKitDeveloperExtrasEnabledPreferenceKey" -bool 'yes'
defaults write '/tmp/com.apple.Safari.plist' "WebKitPreferences.developerExtrasEnabled" -bool 'yes'
mv -v '/tmp/com.apple.Safari.plist' .
cd "$HOME/Library/Preferences/" || exit
cp -avn 'com.apple.Safari.SandboxBroker.plist' 'com.apple.Safari.SandboxBroker.plist.bak' || exit
defaults write "$HOME/Library/Preferences/com.apple.Safari.SandboxBroker.plist" "ShowDevelopMenu" -bool 'yes'
killall cfprefsd
sleep 3
open -a "/Applications/Safari.app" 

Solution 2:

Same issue here - in Big Sur

No terminal use / shell script use

I manually removed all safari settings / cache / preference files

https://macissues.com/2015/06/22/how-to-fully-reset-safari-on-your-mac/

Reinstalled Mac OS .

can now check "Show Develop "