55

I need to restart the WindowServer (OS X's GUI); I know this can be achieved using the command sudo killall -HUP WindowServer but this closes all your open applications. Is there a way to restart the WindowsServer without it quitting all your open applications?

Samantha Catania
  • 3,499
  • 5
  • 27
  • 48

5 Answers5

73

You can also try:

killall -KILL Dock
  • 1
    Does killing the Dock restart the WindowServer? – nohillside Sep 30 '15 at 08:35
  • @patrix It restarts some parts of the UI interface (not sure which). In my case, the top bar was not displaying (time, clock, sound and wifi were invisible...). Restarting the dock fixed the problem. – Benjamin Crouzier Sep 30 '15 at 08:37
  • Fair point, but how does this relate to the problem described in the question? – nohillside Sep 30 '15 at 08:38
  • @patrix It's a way to restart parts of the UI without quitting all your open applications. That might help the OP. – Benjamin Crouzier Sep 30 '15 at 08:39
  • This works quite well when needing to restart the crashed Video portion of the Mac OS X GUI, which was preventing a login via VNC / Mac Remote Desktop. I could still login via SSH, issue the killall -KILL Dock command and have the majority of the apps remain functional and the user still logged in. At the same time, VNC remote access was restored. Thank you sir! – Darkstar Jul 01 '17 at 04:08
  • This solved an issue I had with the GUI not responding to Alt-Tab when it involved apps running in different Spaces. (Swiping left-right still worked to go through them one by one, just not cross-space app switching.) Restarting the Dock restored normal behaviour. – Davor Cubranic Jan 19 '18 at 01:15
  • It reduced the UI jitter, this is what I need, thanks. I've used Automator to created an application that runs this single command and have put the application to the Dock. – Finesse Jun 05 '21 at 01:39
  • This usually fixes it when I'm having UI issues, but I just tried it again and Dock did not start itself again. I ended up having to hard-shutdown the laptop. – forresthopkinsa Mar 08 '22 at 18:32
  • This fixed an issue where spaces started being shared between my monitors despite me having that feature disabled. – gerrard00 Nov 14 '23 at 18:26
  • Killing (restarting) the Dock process fixed a weird issue I had recently with any window whose titlebar I clicked on directly being banished to Desktop 2. Click in the Window to bring forward? Fine. Click on the titlebar and boom: the window disappeared and went to Desktop 2, permanently. No amount of dragging, etc. could get it do go back. Killed the Dock and when it came back, I was able to drag windows around as usual. – Christopher Schultz Dec 13 '23 at 14:38
10

There is no way to restart window server without closing all apps; logging out & then back in is the best option

Samantha Catania
  • 3,499
  • 5
  • 27
  • 48
9

The WindowServer is responsible for drawing all Windows and Windows Content for all Programs (incl. Finder), so it would not be possible to kill the Process without killing all Applications.

You can read about the Window Server in the Apple Technical Note TN2083 for OSX 10.5.

Even though it is announced in that Document that Apple plans to change the Behaviour in future Systemversions, it's in your list of required OS's.

J.C.
  • 2,172
  • 1
    I think the note about removing it is referring to the fact that the window server is available from the global bootstrap namespace, not removing the entire window server. – ughoavgfhw Sep 12 '11 at 22:34
  • "not possible" is stretching it, as Linux X window managers can restart fine without closing applications. Apple's architecture does not seem to allow restarting windowing without closing all applications. – user1338062 Sep 11 '20 at 05:18
7
killall Finder         # what should work
killall SystemUIServer # what to run in addition if it does not

If any of the two do not restart (finder sometimes does not automatically reboot in my experience), then run these commands after the initial set:

open -a Finder
open -a SystemUIServer

This set of commands (specifically killall Finder) is almost exactly like taskkill /IM explorer.exe within the MS-DOS command line.

wrothe
  • 102
  • 8
0

If this is to restart the GUI without quitting all applications (to solve UI jitter, a duplicate mouse cursor, etc...) I found turning off the display works as well.

This earlier question has some information on how to do this.