Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Reliably relaunch the Finder Desktop
In the past I've relaunched finder by using Force Quit (Command + Option + esc). The problem I've had is that while this quits Finder, the Finder doesn't reliably restart. Here is a way that I've found that reliably quits AND relaunches Finder. In the Terminal, type:
killall Finder && open /System/Library/CoreServices/Finder.app
Alternatively you could do:
% ps -caux | grep Finder
to find Finder's PID, and then:
kill pid# && open /System/Library/CoreServices/Finder.app
To kill and relaunch the Finder (where pid# is the PID from the previous step).
    
    •    
  • Currently 3.17 / 5
  You rated: 2 / 5 (12 votes cast)
 
[114,726 views]  

Reliably relaunch the Finder | 11 comments | Create New Account
Click here to return to the 'Reliably relaunch the Finder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Reliably relaunch the Finder
Authored by: epec254 on Jan 23, '04 11:36:25AM
Why not just use this line...?
killall -HUP Finder


[ Reply to This | # ]
killall
Authored by: gatorparrots on Jan 23, '04 12:49:11PM
Doesn't seem to work out of the box:
[gator:~]$ killall -HUP finder
No matching processes belonging to you were found
[gator:~]$ ps auxc | grep Finder
gator     866   0.0  1.5   298784  20312  ??  S    Wed07AM   8:33.74 Finder


[ Reply to This | # ]
killall
Authored by: nvannote on Jan 23, '04 01:23:40PM

That's because you misspelled 'Finder' as 'finder' in your killall command. It is case sensitive.

Regards



[ Reply to This | # ]
Another way (better?)
Authored by: jolinwarren on Jan 23, '04 03:43:27PM
Actually, I would suggest that the 'cleanest' way to restart the Finder is to use the following command:

osascript -e 'tell app "Finder" to quit'
You can then relaunch the Finder by clicking its icon in the Dock. The advantage of this is that you are sending the Finder the standard "Quit" AppleEvent, which is the native way of communicating with Mac applications, so the Finder should do any clean-up necessary before quitting.

[ Reply to This | # ]
Another way (better?)
Authored by: makip on Mar 27, '05 10:48:39PM
That AppleScript has the same effect as choosing the Quit menu item in the application, which I dont believe will work for a non-responsive application. The following command sends the default TERM signal:
killall Finder
The available signals for stopping a progam, in order of niceness are TERM, QUIT, KILL.
killall -QUIT Finder
killall -KILL Finder
If the TERM fails to terminate a program, the next step would be to try QUIT. If the program does not respond to QUIT either, then as a last resort the KILL signal should be used. KILL cannot be ignored by a program, the operating system will terminate it immediately. TERM and QUIT are designed to give a process the chance to clean up before exiting, whereas KILL will stop the process whatever it may be doing.

You can see a list of all signals (not all are for killing) with kill -l. A summary of the ones for killing a program are:
HUP Hangup - stop running. Sent when you log out or disconnect a modem
INT Interrupt - stop running. Sent when you type CTRL-c
QUIT Quit - stop running (and dump core). Sent when you type CTRL-\
KILL Kill - stop unconditionally and immediately; "emergency kill."
TERM Terminate - terminate gracefully, if possible
STOP Stop unconditionally and immediately; continue with CONT
CONT Continue - continue executing after STOP or TSTP
The kill command is named because of the nature of the default TERM signal, but in general it's used to send a variety of signals to programs. There are summaries on the man pages man kill and man killall but they're not very useful to learn from. Better descriptions can be found by googling something like "unix signals kill term quit".

Having said all that, if I want to re-launch my Finder while it is still responding, I like to use option+click & hold on the Finder dock icon, then select re-launch, as described elsewhere on this page.

regards, Maki.

[ Reply to This | # ]
Reliably relaunch the Finder
Authored by: Frederico on Jan 23, '04 10:08:31PM

And to be another one of those 'here's yet another way to do things' guys, use TinkerTool or similar to add the 'Quit (Command-Q)' to the Finder's menu; then either click the Finder's Dock icon to relaunch, or, better, assign a hotkey to activate/launch the Finder (I use Control-F).

So, when I want to quit/relaunch Finder, it's Control-F, Command-Q, Control-F. Sweet.

Too bad Application Switcher (Command-Tab) will not allow you to quit (Q) Finder like other apps, though it will, of course, let you hide (H) it.



[ Reply to This | # ]
Reliably relaunch the Finder
Authored by: aranor on Jan 24, '04 07:01:03AM

Hasn't this site already covered the option+click&hold on the Finder icon in the Dock? That provides a Relaunch menu, and that's something that I believe to be reliable. So this hint is misleading.



[ Reply to This | # ]
Reliably relaunch the Finder
Authored by: bostmass on Jan 25, '04 12:28:15AM
(* The other option you can do is copy and paste this AppleScript into Script Editor. Then save it in your Script Menu items as a
compiled script. Many times when my Finder craps out, other apps follow its lead. You can also customize it to just focus on the finder.
This script does not target background processes.
*)

tell application "Finder"
    if the (count of processes) is not 0 then
        set visible of every process to true
        --set the_apps to get processes whose visible is true
    end if
    
    set the the_apps to the name of every process whose visible is true
    activate me
    set my_apps to {}
    set the my_apps to choose from list the_apps with prompt
        "Choose apps to quit. Press command or shift key for multiple selections:" cancel button name "Cancel" OK button name "Ok" with multiple selections allowed
end tell

repeat with anApp in my_apps
    set anApp to quoted form of anApp
    ignoring application responses
        try
            do shell script "killall -c " & anApp
        end try
    end ignoring
end repeat

[ Reply to This | # ]
Reliably relaunch the Finder
Authored by: john love on Jul 12, '06 05:58:31AM

Somehow quitting and then relaunching the Finder suddenly became way too complicated; for example, using TinkerTool to add "Quit" to the Finder menu and then clicking on the Dock to relaunch it.

So, I went to Apple's Script Editor and recorded the click on the Dock and came up with this simple Script:

tell application "Finder"
activate
quit
select window of desktop -- relaunches Finder
end tell



---
Touch the Future! Teach!!



[ Reply to This | # ]
Reliably relaunch the Finder
Authored by: john love on Jul 12, '06 06:29:17AM
Whoops -- add some delay as follows:

tell application "Finder"
activate
quit
delay 2
select window of desktop -- relaunches Finder
end tell

That delay was discovered by "jonn8" at http://bbs.applescript.net/viewtopic.php?id=4991

---
Touch the Future! Teach!!

[ Reply to This | # ]

Reliably relaunch the Finder
Authored by: john love on Jul 12, '06 06:39:08AM
Whoops -- add some delay as follows:

tell application "Finder"
activate
quit
delay 2
select window of desktop -- relaunches Finder
end tell

That delay was discovered by "jonn8" at http://bbs.applescript.net/viewtopic.php?id=4991

---
Touch the Future! Teach!!

[ Reply to This | # ]