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

Retrieve hidden X11 apps after Finder crashes Desktop
I work with UNIX servers in my day job, and love having X11 on my Mac systems. Unfortunately, every now and then the Finder either crashes or is restarted for some reason. When that happens, any X11 applications minimized to the Dock disappear and can't be reactivated. You can see the application if you control-click on the X11 Dock icon, but if you select any of them, nothing happens.

I found that if I kill and restart quartz-wm then the hidden applications will reappear. Having had this happen to me several times, I came up with this quick fix. First, make a backup copy of /etc/X11/xinit/xinitrc. Next, using sudo, edit the original, replacing this line at the bottom of the file:
exec quartz-wm
with this:
while :
do
  quartz-wm
  sleep 5
done
Restart X11 after you make this change. Now, the next time the Finder dies/restarts and you find yourself with missing X11 windows, either open a new xterm from X11, or launch Terminal and run this on the command line:
ps -ax | grep [q]uartz-wm | awk '{print $1}' | xargs kill
This finds the process id (pid) of quartz-wm (and skips the pid of grep) and sends it to kill. In five seconds, quartz-wm will restart and all of your missing X11 apps should reappear. If this doesn't happen, then you have stubborn quartz-wm that doesn't want to die. Just repeat, but add the -KILL (same as -9) option to kill:
ps -ax | grep [q]uartz-wm | awk '{print $1}' | xargs kill -KILL
Note: If you mess up your xinitrc file, just use Terminal.app to copy your backup back into place and try again.
    •    
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[9,926 views]  

Retrieve hidden X11 apps after Finder crashes | 13 comments | Create New Account
Click here to return to the 'Retrieve hidden X11 apps after Finder crashes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Retrieve hidden X11 apps after Finder crashes
Authored by: jdv on Feb 21, '06 07:55:51AM
ps -ax | grep [q]uartz-wm | awk '{print $1}' | xargs kill -KILL
As far as I can see the following should do the same thing with a bit less typing:
killall -9 quartz-wm


[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Nem on Feb 21, '06 09:41:26AM

True, 'killall' will work, but it's sometimes nice to see how to do things on the command line. Also, if you use multiple UNIX systems, 'killall' isn't always there or is under a different name (under Solaris it's called 'pkill').

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: RickoKid on Feb 21, '06 02:45:19PM

True.

But how many people are running Finder on Solaris?

;o)



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: RickoKid on Feb 21, '06 02:43:22PM
Shouldn't you be able to use
killall -HUP quartz-wm
to just restart it without having to have the code autorestarting it?

Well I tried this and it just quit X11 all together ... so maybe not!

[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Nem on Feb 21, '06 03:59:11PM

Exactly. The way X11 usually works (on any system, not just Mac) is that it will continue to run as long as the "xinitrc" is running. Running "exec quartz-wm" overlays the memory taken up by xinitrc, but in essense, X11 still thinks its running. By killing quartz-wm, X11 thinks the xinitrc ended, and thus exits.

Again, for heavy X11 users, not a nice solution to have all of your apps (not just the ones that disappeared) to suddenly go away.

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Nem on Feb 21, '06 09:43:50AM

Hmm... I sent in this hint, but it says "Anonymous". I'm pretty sure I was logged in at the time. Oh well. ;-)

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: adrianm on Feb 21, '06 10:19:40AM

No no, I sent it in and so did my wife!



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Nem on Feb 21, '06 04:05:12PM

I should mention ... in my write-up above I stated that when the Finder crashed, this causes the problem to manifest itself. In further testing to replicate the problem, it is when the *Dock* crashes/dies/is killed, and not the Finder.

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Han Solo on Feb 21, '06 04:38:33PM

How are you crashing the Dock? Not to suggest that your hint is not potentially useful, but wouldn't a better solution be to identify the cause(s) of your problems with the Dock (or Finder)?



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: Nem on Feb 21, '06 06:34:38PM

As to why the Dock is crashing? Well, its not just from crashing, but any restart of the Dock. It happened after I installed the 10.4.4 update (but before I rebooted). Also, I have my "Applications" and "Utilities" folders in my dock and often right-click or ctrl-click to run an app quickly. On rare occasion, I'll right click on Applications and the Dock will just die. 5 seconds later, I'll try the same thing, and it'll work perfectly.

I'm not sure if the problem is with the Dock or with X11, and most people will never notice the problem (unless they're like me, and running X11 with 4-6 xterms, several of which often sit in the Dock until I need them).

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]
Retrieve hidden X11 apps after Finder crashes
Authored by: robg on Mar 06, '06 11:50:15AM

Fixed now :)

-rob.



[ Reply to This | # ]
Use your own xinitrc
Authored by: buck on Feb 21, '06 07:38:52PM

An alternative to editing the system-wide xinitrc is to copy /etc/X11/xinit/xinitrc to $HOME/.xinitrc and make changes there. A user .xinitrc, if found, will be used instead if found when X11 is started.



[ Reply to This | # ]
What happens when you reboot or shutdown but...
Authored by: kholburn on Feb 22, '06 03:06:09AM

How do you kill X11 then? If you quit it will it attempt to restart? Indefinitely?



[ Reply to This | # ]