Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Is there a way to flash the screen from the command line? I am looking for the same effect that Accessibility does for "Flash the screen when an alert sound occurs", but I don't want it for every alert.

share|improve this question

3 Answers 3

As far as I know, you can't replicate this alert without enabling that option. If you do enable that option, you can cause a flash from Terminal using:

osascript -e "beep"

However, if you don't want to enable that option, you can use invert colours. Using the invert colours Accessibility option twice causes the screen to flash, therefore pressing the keyboard shortcut ⌃⌥⌘8 twice will cause a flash:

#!/usr/bin/osascript
tell application "System Events" to repeat 2 times
key code 28 using {command down, control down, option down}
delay 0
end repeat
share|improve this answer
    
The invert is a good alternative. Thanks. –  studgeek Apr 13 at 2:17

It doesn't flash the whole screen (unless you have terminal set to full screen) but if you go to Preferences > Settings > Advanced and select "Visual Bell" you can then type:

echo ^G

(The keystrokes to get the correct characters are: echo control + v control + g because the control character has to be quoted)

to flash the terminal window.

share|improve this answer
1  
Whilst this works, the effect is very subtle on my default Terminal profile. –  George Garside Apr 11 at 16:34

For others, one alternative I have found is to use this screenbrightness command line tool (http://apple.stackexchange.com/a/127258/23876) like so. It only works on the main display though:

screenbrightness 0; sleep 1; screenbrightness 1
share|improve this answer
    
something is missing ? –  Buscar웃 Apr 11 at 17:25
    
What is missing @Buscar? –  studgeek May 9 at 16:52
    
I tired it, and it does not work on my MBA 10.9.2 Error -bash: screenbrightness: command not found –  Buscar웃 May 9 at 17:06

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.