1

I disabled SIP (How do I disable System Integrity Protection (SIP) AKA "rootless" on OS X 10.11, El Capitan?) and started editing the file /Library/Preferences/SystemConfiguration/preferences.plist

I successfully edited the entries HTTPProxy, HTTPPort, HTTPEnable and save the file. Then I checked my IP address on the web, and it doesn't change. The file is set correctly, but the system doesn't know it changed and therefore it uses the old settings. When changing settings manually, hitting Apply in the Network Tab notifies the system that preferences.plist has changed and that it must use the new settings. Same goes for turning wifi off and on. I changed the file, checked the IP (it is the same) turn wifi off/on, checked the IP and now it has changed.

How can I trigger that event of notifying the system of changes programmatically on a Mac?

  • Oh, I read your answer in more detail and you are correct. Still I think the problem persist even with SIP being enabled. – sanjihan Mar 24 '16 at 21:19
1

This is the wrong way to adjust the network settings on OS X. The network is managed by configd, which reads its settings from /Library/Preferences/SystemConfiguration/preferences.plist at startup. Changes should be made via configd, so that it can update its live state, the actual network interface settings, and the preferences file all together.

I know of three ways of doing this: via the Network pane in System Preferences, with the networksetup command, and with the scutil command. scutil is messy, so I don't recommend it; fortunately networksetup is easy to use. Something like this should work:

sudo networksetup -setwebproxy Ethernet proxyserver.example.com 80 off

Note that "Ethernet" is the user-friendly name of the network service (/interface); use networksetup -listallnetworkservices for a list. Also, the "off" argument means that proxy authentication is off. See the networksetup man page for more info.

BTW, please turn SIP back off. You do not need to turn it off in order to change the network settings.

  • Thank you. I tried that and a am getting an error "error -25299 attempting to create account and password for proxy: myProzyIp myPort". However upon checking IP in the brwoser, I am indeed behind a proxy. – sanjihan Mar 25 '16 at 10:04
  • @sanjihan I think that means you're trying to configure an authenticated proxy, but the username and password are already in the keychain. Error -25299 seems to have to do with adding keychain entries that're already there. – Gordon Davisson Mar 25 '16 at 18:55
0

Your question needs some editing and clarification.

What I think you're asking is, how to force OS X to re-load data after editing a plist file. There are two methods of doing this.

OS X uses a caching daemon for preferences, cfprefsd. You can simply save your plist file, then do sudo killall cfprefds. It will restart automatically, and should load your changes.

The recommended way of forcing changes is with the defaults command, which informs the daemon of the changes. For example

# Reveal IP address, hostname, OS version, etc. when clicking the clock
# in the login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
  • Hoever that only rereads those running from the GUI other prefs won't get reread - you need to reboot – Mark Mar 25 '16 at 0:51
  • I got "No matching processes were found" when running sudo killall cfprefds. – sanjihan Mar 25 '16 at 8:13
  • You made a typo – Hefewe1zen Mar 25 '16 at 12:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .