RStudio breaks on FreeBSD: "TypeError: undefined is not an object (evaluating 'window.desktopHooks.notifyRCrashed')"



The executable built by the FreeBSD port prints this message, and doesn’t show menus.

I think, it tries to print some error message, but the error procedure itself fails with undefined Java Script object.

Version 1.1.409


I can’t directly your question as to why you get this error but it has come up before. It seems to be related to incompatible versions of packages as best I can understand it. Maybe these discussions of issues on Github will give you some insight, though none of them seem to be exactly what you are seeing.


@yurivict: In general, that error implies that the R session died quite early on in startup when RStudio attempted to launch it. Unfortunately, it can often be tough to diagnose these ‘crash on startup’ issues, but there are a few things you can try.

Do you see any reports in the system logs from RStudio? It’s possible some diagnostic information is being emitted to the logs before crash.

You might also try using gdb to attach to the rsession process when it is launched (RStudio will launch the rsession process soon after launch). I’ve used the gdwait snippet defined here in the past with some success:

If that succeeds, you could hopefully figure out what’s going on when the rsession process exits. Is it a crash (SEGV or similar)? Or is the process exiting early for some other reason?

Finally, the current release of RStudio is v1.1.423, and we’d highly recommend that you base your port off of that release if at all possible as we’ve fixed a number of issues in the patch releases of RStudio v1.1 (see for a full list)


R didn’t crash. It exited gracefully (see exit(0)):
7325 R RET sigprocmask 0
7325 R CALL close(0x3)
7325 R RET close 0
7325 R CALL exit(0)
7314 rstudio GIO fd 18 read 0 bytes
7314 rstudio RET read 0

The error message looks like some JavaScript failed. Could you, maybe, fix this JavaScript to see what would have happened without this error?


RStudio-1.1.432 still fails the same way.
R session doesn’t fail.

How can I fix the FreeBSD port?

Somebody had the same message in JavaScript in 2013:

So, this is a long-standing problem. It should have a priority.


The JavaScript error is not related in the way you think it is related. The R session is trying to notify the front-end that the R session has crashed / abruptly exited early for some reason, but it’s happening before the hooks have actually been registered.

In other words, the R session is exiting early for some reason, and until we learn why there’s no way for us to diagnose or help on this issue.

If you want to convince yourself, the code is being executed from this codepath:

So we need to understand why the R session is exiting early.

Do you see any reports in the system logs from RStudio? It’s possible some diagnostic information is being emitted to the logs before crash.


You can also try running

/usr/lib/rstudio/bin/rstudio --run-diagnostics

to generate a diagnostics report that might provide more clues as to what’s going on. (Replace /usr/lib/rstudio/bin/rstudio with the appropriate path to rstudio if you’ve moved it / installed it elsewhere)


Hi Kevin,

Now I see that my R session is failing (due to some library incompatibilities).

When I just run R with the same environment that “run-diagnistics” prints, it runs fine.

How can I run R in exactly the same way as RStudio runs it?


I figured this out. RStudio sets LD_LIBRARY_PATH for rsession that contains /lib, which for some reason causes the wrong to be used on FreeBSD.

I patched the port to use LD_PRELOAD= with the right library.