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

UPDATE:Thanks to Eric Bachard, a fix very similar to this will be appearing in OpenOffice.org 2.4.2 due to be released at the end of October 2008.

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.

82 comments

  1. 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!

  2. 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

  3. 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.

  4. 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.

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

    “The application soffice.bin quit unexpectedly”

  6. 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?

  7. 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?

  8. 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!

  9. 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

  10. 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!

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

  12. 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

  13. glad i found this link …
    iBook PPC-G4/1GHz 1.25GB RAM
    MacOSX Leopard 10.5.3
    XQuartz 2.2.2
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
    OO 2.4.0

    it absolutely works. Thanks a lot …

  14. Hi i found the script and pasted the following
    *==== (global variables as get-functions) ====*)

    on getOOInstallPath()
    return (((path to me) as string) & “Contents:”)
    end getOOInstallPath

    on getOOResourcesPath()
    return (((path to me) as string) & “Contents:Resources:”)
    end getOOResourcesPath

    on getOOProgramPath()
    return (getOOInstallPath() & “MacOS:”)
    end getOOProgramPath

    on getScriptPath()
    — set this to absolute path when debugging
    return (((path to me) as string) & “Contents:Resources:Scripts:”)
    end getScriptPath

    on getOOUserSettingsPath()
    return (((path to home folder) as string) & “Library:Application Support:OpenOffice.org:2:”)
    end getOOUserSettingsPath

    on getOOUserFontPath()
    return (getOOUserSettingsPath() & “user:fonts:”)
    end getOOUserFontPath

    on getUserLogsPath()
    return (((path to home folder) as string) & “Library:Logs:”)
    end getUserLogsPath

    on shellTerminator()
    return (” &>/dev/null & echo $!”) as string
    end shellTerminator


    — the default handlers: run, open, idle, quit

    on run
    if (preRun()) then
    logEvent(“(Scripts/main) Running OpenOffice.org”)
    openSoffice(“-“)
    end if
    end run

    on open (theFiles)
    if (preRun()) then
    openFiles(theFiles)
    end if
    end open

    on idle
    — close icon only if ooo has terminated
    if (hasOOoQuit()) then
    tell me to quit
    end if
    — check all x seconds if ok to quit
    return 3
    end idle

    on quit
    if (hasOOoQuit()) then
    continue quit
    end if
    end quit

    ————————————————————-

    on preRun()

    — Check for the required version of Mac OS X
    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
    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

    — Check for that OOo can be found
    if (not isRealPath(getOOProgramPath())) then
    display dialog getMessage(“ERROR_OOO_NOT_FOUND”)
    return false
    end if

    if (not isRealPath(getOOUserFontPath())) then
    set createUserFont to “mkdir -p ” & (quoted form of POSIX path of getOOUserFontPath()) & “; ”
    do shell script createUserFont
    end if

    — If no crash occured before, ~/Library/Logs does not exist, and OpenOffice.org cannot be started
    if (not isRealPath(getUserLogsPath())) then
    set createUserLogsPath to “mkdir -p ” & (quoted form of POSIX path of getUserLogsPath()) & “; ”
    do shell script createUserLogsPath
    end if

    this did not fix it please send by email the complete script if posible

    Cheers John Lang

  15. Hi I had a other go at it only to find that it would not save it so in short it is outside my capability a cut and past solution would be handy or a patch to fix it
    as it stands today I can not work with open office all my files were created by open office before I upgraded to Leopard
    Cheers John Lang Australia

  16. Dear Shaun!

    You saved my day with this script change! my wife was so angry about me (yeah, as if i did something to her pc…) it took me half a night to get to your blog, but now it works, so:

    thank you very much!

    yours,

    rob from vienna (if you ever come here, write me an email)

  17. I’m more of just an “end user” but I was able to follow your instructions. This, combined with reloading active X solved me problem of not being able to open Open Office after an upgrade from Mac. Thank you so much because I would have lost a lot of precious data because of course, I had not backed up in a month. Thank you!

  18. Hallo,

    i changed the script (/Applications/OpenOffice.org 2.4.app/Contents/Resources/Scripts/main.scpt) according instructions. Then i tried to start OpenOffice from Finder/Application folder. X11 and as well OpenOffice are displayed among running aplication. But OO menu consist just from 3 menues (OpenOffice.org, File,Edit) and exept Edit Script all submenues are dimmed and I cant open new document or create new.

    Tomas

  19. @Tomas, click the X11 icon, and it should activate the OpenOffice.org X11 window, thus allowing you to use the menus inside that window. With the X11 version you don’t use the menus in the Mac OS X menu bar like you do with other Mac apps. Instead you use the menus inside the application window.

    Alternatively go to and use the Aqua version, which is more up to date, and more importantly is more Mac like.

  20. Hi Shaun,

    today it works fine. I simply did the same like tommorow many times ( close the X11 standardly, and Force Quit the OO). After new starting of OO it start to work with menu inside Application window.

    Thanx and bye.

    p.s. I am former windows c++ developer which decided switch to MAC for the rest of the life…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.