How can I make pref changes via defaults command happen immediately?

Posted by user329863 on Super User See other posts from Super User or by user329863
Published on 2014-06-06T02:45:48Z Indexed on 2014/06/06 3:28 UTC
Read the original article Hit count: 340

Filed under:
|
|
|
|

There are many changes to Finder, Dock, etc. preferences that you can do with the defaults command, i.e.

defaults write com.apple.finder AppleShowAllFiles -bool yes

However, in order to make the changes take effect, you must quit and relaunch the target app:

osascript -e 'tell app "Finder" to quit'

When the Finder is quit like this (rather than using the killall command, as some published sources advise), it saves and restores its window placements and disk locations (but not the forward-and-back history associated with each window). Is there some way to make such changes take effect immediately, without quitting the target app? After all, when you make changes in the Dock preference panel, they take effect instantly in the Dock application. Is there some Apple Event that I can send to make the change or make the app reread its prefs?

© Super User or respective owner

Related posts about osx

Related posts about mac