Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a Service with Automator on a Mac running "Lion 10.7.3". The Service toggles via a shell script the visibility of hidden files in the Finder and works like a charm. Here's the script:

STATUS=`defaults read AppleShowAllFiles`
if [ $STATUS == YES ]; 
    defaults write AppleShowAllFiles NO
    defaults write AppleShowAllFiles YES
killall Finder

Because this script was doing so nice, I thought I could do a similar script that toggles the key closeViewZoomFollowsFocus between the values TRUE and FALSE. So I did another script:

STATUS=`defaults read closeViewZoomFollowsFocus`
if [ $STATUS == TRUE ]; 
    defaults write closeViewZoomFollowsFocus FALSE
    defaults write closeViewZoomFollowsFocus TRUE

The problem with this script is that the change takes no effect. To be precise: The script changes the value as it should, I checked it in the Terminal with defaults read closeViewZoomFollowsFocus. But the change is not activated.

In my original script that toggles the hidden files I solved this with killal Finder. Unfortunately I have no idea how to achieve an instant activation of the changed default in my second script.

When you change the same default via the System Preferences, it does take effect instantly without logoff/logon or anything else. So I wonder about a command that activates such a change instantly in the background. Any ideas?

share|improve this question
Feel free to include links to the screenshots and we can embed them for you. – Nathan Greenstein Feb 26 '12 at 19:33
Thank you - it's no longer relevant. – Universal Feb 26 '12 at 22:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.