Sunday, March 30, 2008

OOO: Possible fix for the command timed out error on Leopard

With a change in the way that X11 works on Leopard, the X11 version of OpenOffice.org has been giving an error message on startup saying "command timed out". With previous versions of Mac OS X, OpenOffice.org had to make sure that X11 was running first be trying to start OpenOffice.org.


The following change should work for 2.4, 2.3.1, 2.3, and possibly earlier versions. Open the file OpenOffice.org 2.4.app/Contents/Resources/Scripts/main.scpt in "Script Editor". (You will need to control+click the application icon and choose "Show Package Contents".)

Then replace the code block "on openSoffice(aFile)"...."end openSoffice" with the following:

on openSoffice(aFile)
if (atLeastOSXVersion(10, 5, 0)) then
-- if we have leopard, we don't need to manually start the X server first
set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() & "soffice")) & " "
do shell script theCmd & aFile & shellTerminator()
else
set theDisplay to startXServer()
if (theDisplay is equal to "error") then
return
end if
set theEnv to "DISPLAY=" & theDisplay & " ; export DISPLAY; "
set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() & "soffice")) & " "
do shell script theEnv & theCmd & aFile & shellTerminator()
-- logEvent("open CMD: " & theEnv & theCmd & aFile)
end if
end openSoffice

Please comment on how this works for you.

72 comments:

maveric said...

Problem solved. Thank you Shaun. Would be nice if we can get it out with a possible 2.4.1.

Plus we should make it public and post it in forums and on (trouble shooting) websites plus our own homepage.

The Major said...

Worked for me, too. Thank you very much.

Peter

Allen & Liz said...

Yep, this worked fine. Still don't like the way OOo depends on X11 & doesn't run stand alone.

Shaun McDonald said...

Allen & Liz: You should try the test aqua version then.

Jeff said...

Excellent! Worked very well.
Thanks very much.
-Jeff

s.engel said...

Thanks a lot. Your script solved this annoying problem for me.

Anonymous said...

Perfect. Thanks

Anonymous said...

Worked fine for me, Thanks.
OSX 10.5.2, OO 2.4

Rooktoven said...

Worked for me as well. Thanks!

Anonymous said...

Hmm the message went away but now OO won't start. It appears to. X11 starts. then OO seems to close without anything happening.

Shaun McDonald said...

Can you start OpenOffice.org by running /Applications/OpenOffice.org\ 2.4.app/Contents/MacOS/soffice in the xterm or terminal?

If not try to remove the application preference and see if that works.

Anonymous said...

Perfect - worked for me. Thanks a lot.
OSX 10.5.2
OpenOffice 2.3

Matt said...

Fabulous! Works for me on 2.4, thanks!

Fletch said...

Worked perfectly for me on 10.5.2 with OO 2.4.0! Thanks Shaun!

LIN said...

thanks dude, works like magic! 10.5.2 OO 2.4.0

Anonymous said...

Script works great. Thanks very much for fixing this annoying problem. I'm running OO 2.3.1 with OS X 10.5.2.

Shaun McDonald said...

anonymous: Do you know that OO 2.4.0 is available?

Anonymous said...

Very impressive, works like a charm.

Csaba said...

Worked perfectly. Thanks. Great Script!!!

Anonymous said...

Genius! Worked like a charm on 10.5.2 w/Ooo 2.4.0 intel. Also using X11 2201 update (XQuartz project) Thanks SO much!

BarneyHoe said...

Hi,

this works great! Than you very much for the excellent work

Rolf

Anonymous said...

Thx:) everything works fine, no problems, no errors just pure pleasure :)

Lukasz

Anonymous said...

Thanks Shaun....works very well with my Leopard install. Thanks - no more silly wait!

Tommyjb1 said...

When I attempt to save the script, it says the "Document cannot be saved."

Shaun McDonald said...

Tommyjb1: Are you sure that you have write access to the OpenOffice.org 2.app?

Anonymous said...

This is great. Thanks. Being new to Mac it took me a while to figure just how to do it and that only root could edit the script file but I got there in the end and OpenOffice starts up soooooo much faster now.

Thomas said...

Shaun,

Yep, I have write permissions...nevertheless....

ptamaro said...

This worked for me too Shaun, it was really easy... Thanks for the helpful post!

Sailorcurt said...

As a brand new Mac user, I thank you sir. That was driving me nuts.

You're my hero.

Anonymous said...

Sweet, thanks. I have owned a mac for only a few weeks and this is all new to me. Still was easy to follow and make the changes!

So much better now!

Anonymous said...

I tried everything: go back to X11 1.1.2 on my Leopard or move forward to X11 2.2.1, then found this hint. Now it works.

Doug said...

Your solution worked. Thanks!

Tim said...

Thanks man, worked nicely.

Bryan said...

Thanks. This worked! 10.5.2, X11 v2.2.1, OO 2.4. Makes me want to learn more about AppleScript.

Jeffrey said...

Awesome, this worked for me too. Thanks much.

Anonymous said...

It works for me too. Mac OSx 10.5.2, X11 v2.1.1, OO 2.3.1

NN said...

It worked perfectly on our MacBook running OS X 10.5.2 and OOO 2.4
It also fixed a problem we had on Logging Out from OOO (we had to Force-Quit the process).

Thanks a lot.

Anonymous said...

Works like a charm. It even seems like OO is starting much quicker than before.
OSX 10.5.2
OOO 2.4

Brian said...

Excellent solution. I too need to learn more Applescript.

Mac OS X 10.5.2
OO 2.4

-Brian

Alana said...

Just what I needed. Mac OSx 10.5.2, X11 v2.1.1, OOO 2.4

Anonymous said...

Could anyone please tell me where to find the file to edit? Also, why can't I find anything called "script editor" or similar in my applications or utilities folder?

Thanks a lot.

Jesse

Anonymous said...

Finally found the script editor and the file to edit -- openOffice 2.4 opens smoothly now, thanks Shaun!

Anonymous said...

Shaun, thanks a lot. It did work perfectly for me. O

Anonymous said...

Thank you for helping me to fix this problem.

Anonymous said...

Yes, thank you, it worked for me. Too bad I had to spend 30 minutes searching for your fix, rather than have them implement this themselves.

NS said...

Very smooth, thanks. OS 10.5.3 with Xquartz 2.2.1. Looking forward to looking at the aqua you pointed out.

Jean said...

Perfect, thanks!

Woody UK said...

Did NOT work, I still get the error "Command Timed Out" and then OO just hangs.
I've read and tried all the work-arounds and none of them work including this one.
I was running OO2.2 on Tiger and it worked fine. I've upgraded to Leopard 10.5.3 and neither OO2.2 nor 2.4 will work on it!
I've got a Quad G5 PPC with 16GB Ram & 1TB & 250GB hard drives so there is no issues with performance.
Before I changed the file as you suggested I tried opening X11 1st, even that didn't work. I didn't even need to as when I try to start OO it always opened X11 even before I changed this text.
The only thing I can think of is when I installed Leopard, I copied all my Apps and their folders including Utilities folder with X11 in it, so is it a different version of X11 on Tiger than it is on Leopard and if yes, then I reckon I could have corrupted it.
Anyone know where I can d/l X11 for Leopard from?
I'm glad to hear this fix worked for some of you

Shaun McDonald said...

Woody UK:

I have X11.app 2.2.0.1 - (xorg-server 1.3.0-apple5) on Leopard. (See About X11 in the X11 menu.) I'm using Mac OS X 10.5.3.

It appears that you have corrupted X11 after installing Leopard by copying all your apps over. I think you can do a custom install of Mac OS X Leopard with just installing X11. Then install the Mac OS X 10.5.3 Combo update.

I'd be surprised if you hadn't corrupted any of your other Mac apps like Safari and Mail.

Anonymous said...

Thank you very much. It worked perfectly.

odg9 from Waterloo, Ontario, Canada

Evaporated said...

Worked like a charm. Thanks.

Julián, Mexico City said...

Worked fine on OS X 10.5.3, X11 2.2.2, OOO 2.4.
With a note: since my OS X is in Spanish, it didn't work when I had OOO in English (in te xtem it complained about the locale). Once installed OOO in Spanish and modified the launcher, it worked at once.

Thanks a lot!

Doug said...

Great stuff. Makes so much difference and makes OOo worthwhile using
Doug

Laura said...

Hi Shaun,

I was excited when I saw your article, but unfortunately it didn't work for me. This is a new mac mini (was still in its wrapper yesterday!), 'About this mac' tells me that its MAC OSX version 10.5.3, it really has nothing on it but what was already installed. I downloaded 'OOo_2.4.0_MacOSXIntel_install_en-US.dmg' from http://download.openoffice.org/other.html after the normal download page bounced to it.
I copied it into the applications folder and after asking me if I wanted to use the default fonts it kind of stalled, eventually giving me the timeout message, but in fact would not quit unless I used 'Force Quit'. I found and applied the solution here which didn't work (force quit and restart). Because I had used force quit, I actually trashed the application and copied it again from the dmg trying the solution once again (just start).
Looking online again I saw something about installing X11 or starting it first. X11 looks to be already installed as there is an icon for it in the utilities folder, I did try clicking it first, but to no effect.
One thing that seems strange to me, but may be fixed when/ if I finally get it to work is that the menu for open office when it sort of half starts gives me no options to start the office writer, the spreadsheet or in fact any of the applications.
Please tell me what you think.
Thanks a lot in advance for the help!

Laura

Anonymous said...

Hi,

Super on OS X10.5.3

Thanks again
Tam

Anonymous said...

Works for me on 10.5.3.

Thanks,
John

Anonymous said...

Many Many thanks, this bug had me briefly thinking about obtaining MS Office (Yeugh!. As a web-developer constantly having to create extra code for standards compliant code to work in IE I have a large dislike for microsoft!), worked like a charm on my 5 day old MacBook Pro with 10.5.3 on. You've saved me from polluting my lovely new mac.

Jeff said...

Nope, doesn't work for me. I have tried everything and I still can't get OO to work on this brand new macbook. Thinking of switching back to Ubuntu Linux. Mac is a lot of work to get anything unusual to work on it.

Vin Breau said...

Did not work for me at all. Now when I launch it I get a new error immediately:

"The application soffice.bin quit unexpectedly"

Anonymous said...

thx dude

Anonymous said...

Thanks!!!

verszou said...

Yay! Worked like a charm. Major annoyance gone :-)

Tim said...

Worked for me on OSX 10.5.4 with OO 2.4.1.

SaraQuigley said...

Success!!! Thanks Shaun!

TTD said...

Hi Shaun. I'm nearly there, but I too cannot save. When I get info on 'OpenOffice.org' it says (under sharing & permissions)..."You can only read", while Name "RNW"(Me) as well as 'staff' have privilige 'Read & Write". I can't unlock these settings and the '`ignore ownership on this volume' is checked (and grey). Strange, for I am the administrator.... `any clue?

Anonymous said...

Thanks! This worked for me a couple months ago on OSX 10.5.4 and Oo 2.4, though after installing 2.4.1 I had to re-apply the fix. Any chance this fix could be incorporated into the next release?

Shaun McDonald said...

As the next version will be an aqua version with 3.0, the change will not be required.

Anonymous said...

Thank you SO MUCH! This is my first Mac and I' still getting used to using it versus my old PC. I was really frusterated with this error message until I found and successfully used your fix! Thank you again!

tom Grassman said...

Thank you Shaun!
I am a new apple user and not very knowledgeable about computers in general. Although I don't have a clue about what a "splash" is and I didn't recognize the evidence of a frozen OO (I just thought that the application wasn't opening except on rare occasions which I couldn't correlate with anything I was doing), I did get the time out message and thought I would try your fix before downloading OpenOffice.org 3. It seems to have worked splendidly!
Your instructions were sufficient for even my needs. I greatly appreciate the information you provided. Tom Grassman

Anonymous said...

thanks, but unfortunately, it's still not working for me (i.e., command timed out). Any other suggestions? I have the latest version (10.5.4) and I checked my Activity Monitor and X11 is definitely installed and active, but when I open Open Office, it just hangs. Thanks in advance for any suggestions!

Anonymous said...

Disregard my previous comment. For some reason, today, one day later, it seems to be working. Thanks a lot for posting this solution!

David said...

Thank you! Worked a charm for me. As a mac newbie it was also useful learning how to view the internal contents of an application (Applications, right click on OpenOffice, "show package contents" for anyone else who's as clueless as me!)

MacBook 2.4 Duo, OSX Leopard, OO 2.4.1