# R cannot be initialized - MacOS 10.15.5 - KNIME 4.1.3

**URL:** <https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324>\
**Category:** KNIME Extensions\
**Tags:** scripting\
**Created:** [July 17, 2020, 11:30am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324 "2020-07-17T11:30:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![oliveralka](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/o/b4bc9f/32.png) [@oliveralka](https://forum.knime.com/u/oliveralka)\
**Post date:** [July 17, 2020, 11:30am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/1 "2020-07-17T11:30:57Z")

</div>

Hello Everyone,

I am currently not able to run R Snippets with the following error and I am not sure how to solve it.  
Please let me know if you have any suggestions/ideas how to resolve the issue.

> R cannot be initialized.  
> XQuartz is required for the Cairo library on MacOS. Please download and install XQuartz from [http://www.xquartz.org/](http://www.xquartz.org/).

KNIME log:

> 2020-07-17 13:00:24,094 : ERROR : KNIME-Worker-4-R Source (Workspace) 0:248 : : Node : R Source (Workspace) : 0:248 : Execute failed: XQuartz is required for the Cairo library on MacOS. Please download and install XQuartz from [http://www.xquartz.org/](http://www.xquartz.org/).  
> org.knime.r.controller.IRController$RException: XQuartz is required for the Cairo library on MacOS. Please download and install XQuartz from [http://www.xquartz.org/](http://www.xquartz.org/).  
> at org.knime.r.controller.RController.checkCairoOnMac(RController.java:406)  
> at org.knime.r.controller.RController.initR(RController.java:329)  
> at org.knime.r.controller.RController.initialize(RController.java:195)  
> at org.knime.r.controller.RController.(RController.java:167)  
> at org.knime.r.RSnippetNodeModel.executeInternal(RSnippetNodeModel.java:145)  
> at org.knime.r.RSnippetNodeModel.execute(RSnippetNodeModel.java:136)  
> at org.knime.core.node.NodeModel.executeModel(NodeModel.java:571)  
> at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1236)  
> at org.knime.core.node.Node.execute(Node.java:1016)  
> at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:557)  
> at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:95)  
> at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:218)  
> at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:124)  
> at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:334)  
> at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:210)  
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)  
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
> at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)  
> at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)

R scripting extension is installed:

> KNIME R Scripting extension 4.0.0.v201906200740 de.mpicbg.tds.knime.scripting.r.feature.feature.group Max Planck Institute of Molecular Cell Biology and Genetics (MPI-CBG), Dresden, Germany

I tested with R 3.6.1 and later upgraded to R 4.0.2:

Path: /Library/Frameworks/R.framework/Resources  
or  
Path: /Library/Frameworks/R.framework/Versions/4.0/Resources

Rserve and Cairo are installed:

> library(Rserve)  
> library(Cairo)  
> sessionInfo()  
> R version 4.0.2 (2020-06-22)  
> Platform: x86\_64-apple-darwin17.0 (64-bit)  
> Running under: macOS Catalina 10.15.5
> 
> Matrix products: default  
> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib  
> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
> 
> locale:  
> [1] en\_US.UTF-8/en\_US.UTF-8/en\_US.UTF-8/C/en\_US.UTF-8/en\_US.UTF-8
> 
> attached base packages:  
> [1] stats graphics grDevices utils datasets methods base
> 
> other attached packages:  
> [1] Cairo\_1.5-13 Rserve\_1.8-7
> 
> loaded via a namespace (and not attached):  
> [1] compiler\_4.0.2 tools\_4.0.2

XQuartz is installed:

> XQuartz 2.7.11 (xorg-server 1.18.4)  
> /opt/X11/bin/xquartz

MacOS 10.15.5  
KNIME 4.1.3

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [July 17, 2020, 11:49am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/2 "2020-07-17T11:49:23Z")

</div>

Hi there @oliveralka,

welcome to KNIME Community!

Have you checked this _R Installation guide_?  
[https://docs.knime.com/2020-07/r\_installation\_guide/index.html](https://docs.knime.com/2020-07/r_installation_guide/index.html)

And this topic can help as well:

> [@Install R alongside KNIME on Windows and MacOS](https://forum.knime.com/t/install-r-alongside-knime-on-windows-and-macos/13287):
>
> Over the last months I have collected a few entries about the installation of [R](https://www.r-project.org) alongside KNIME that contain some maybe useful hints how to overcome certain obstacles while installing them. I want to bring them together here. (If you are looking for a basic guide about how to install R in the first place you might look [here](https://medium.com/@GalarnykMichael/install-r-and-rstudio-on-windows-5f503f708027) or [here](https://www.dummies.com/programming/r/how-to-install-r/)). A few maybe unnecessary remarks upfront. Yes it takes some effort to get KNIME and R up and running but in the end you will be rewarded with the whole world of pos…

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![oliveralka](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/o/b4bc9f/32.png) [@oliveralka](https://forum.knime.com/u/oliveralka)\
**Post date:** [July 17, 2020, 12:05pm UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/3 "2020-07-17T12:05:51Z")

</div>

Hi Ivan,

I went over the topics already and also did a test with installing the packages via your script:  
[https://bitbucket.org/KNIME/knime-r/src/master/org.knime.r/scripts/](https://bitbucket.org/KNIME/knime-r/src/master/org.knime.r/scripts/)

Unfortunately, that did not solve the issue.

Rserve and Cairo seem to work without any issue when called in R directly, but somehow in  
KNIME XQuartz is not recognized.

The path to R.home is set as “/Library/Frameworks/R.framework/Versions/4.0/Resources”, which should be fine.

Any ideas on how to narrow down the error?

---

<div class="post-metadata">

**Author:** ![oliveralka](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/o/b4bc9f/32.png) [@oliveralka](https://forum.knime.com/u/oliveralka)\
**Post date:** [July 20, 2020, 2:25pm UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/4 "2020-07-20T14:25:08Z")

</div>

It seems that KNIME is checking the `kMDItemVersion` using `mdls`.

> <https://github.com/knime/knime-r/blob/3075c8c3018977c85b7b84afda2d691c90e99fb6/org.knime.r/src/org/knime/r/controller/RCairoChecker.java#L123>

I downloaded and installed the current XQuartz 2.7.11 from [https://www.xquartz.org/](https://www.xquartz.org/), but it seems that no kMDItemVersion is available.

```
user@MBP Utilities % pwd
/Applications/Utilities
user@MBP Utilities % mdls XQuartz.app 
kMDItemFSContentChangeDate = 2020-07-17 08:17:51 +0000
kMDItemFSCreationDate = 2016-09-26 07:41:50 +0000
kMDItemFSCreatorCode = ""
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = 0
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = 0
kMDItemFSLabel = 0
kMDItemFSName = "XQuartz.app"
kMDItemFSNodeCount = 1
kMDItemFSOwnerGroupID = 0
kMDItemFSOwnerUserID = 0
kMDItemFSSize = 1
kMDItemFSTypeCode = ""
user@MBP Utilities % mdls -name kMDItemVersion XQuartz.app 
kMDItemVersion = (null)

```

Which leads to the described issue above.

I am actually not sure why this happens, since the right version seem to be annotated in the bundle:

> ```
> user@MBP Utilities % plutil -p /Applications/Utilities/XQuartz.app/Contents/Info.plist | grep CFBundleShortVersionString 
> 
> "CFBundleShortVersionString" => "2.7.11
> 
> ```

Edit:  
Currently I think this is a specific issue on my system, since it works for other macOS 10.15.5 - I will take a look and post an update here.

---

<div class="post-metadata">

**Author:** ![Mark\_Ortmann](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@Mark\_Ortmann](https://forum.knime.com/u/Mark_Ortmann)\
**Post date:** [July 21, 2020, 7:00am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/5 "2020-07-21T07:00:33Z")

</div>

Interesting. Have you tried an older version of Xquartz? Maybe you could try to install the same version someone who can use those nodes has installed?

I would really much appreciated if you could keep us posted about your findings.

Best  
Mark

---

<div class="post-metadata">

**Author:** ![oliveralka](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/o/b4bc9f/32.png) [@oliveralka](https://forum.knime.com/u/oliveralka)\
**Post date:** [July 21, 2020, 7:04am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/6 "2020-07-21T07:04:39Z")

</div>

I have not found a fix yet - but it does not seem to be an XQuartz or KNIME issue but is related to a faulty Spotlight Index on MacOS.

Checking the available metadata stored in the XQuartz app directory give the expected results:

> user@MBP ~ % mdimport -t -d 3 /Applications/Utilities/XQuartz.app  
> Imported ‘/Applications/Utilities/XQuartz.app’ of type ‘com.apple.application-bundle’ with plugIn /System/Library/Spotlight/Application.mdimporter.  
> 31 attributes returned  
> {  
> “:MD:DeviceId” = 16777220;  
> “:MD:kMDItemPath” = “/Applications/Utilities/XQuartz.app”;  
> “\_kMDItemContentChangeDate” = “2020-07-17 08:17:51 +0000”;  
> “\_kMDItemCreationDate” = “2016-09-26 07:41:50 +0000”;  
> “\_kMDItemCreatorCode” = 0;  
> “\_kMDItemDisplayNameWithExtensions” = {  
> “” = “XQuartz.app”;  
> };  
> “\_kMDItemFileName” = “XQuartz.app”;  
> “\_kMDItemFinderFlags” = 0;  
> “\_kMDItemFinderLabel” = 0;  
> “\_kMDItemFromImporter” = 1;  
> “\_kMDItemIsExtensionHidden” = 1;  
> “\_kMDItemIsFromImporter” = 1;  
> “\_kMDItemNodeCount” = 1;  
> “\_kMDItemOwnerGroupID” = 0;  
> “\_kMDItemOwnerUserID” = 0;  
> “\_kMDItemTypeCode” = 0;  
> “com\_apple\_metadata\_modtime” = “616666671.485049”;  
> kMDItemAlternateNames = (  
> “XQuartz.app”  
> );  
> kMDItemAppStoreCategory = {  
> “” = Utilities;  
> ar = “\U0627\U0644\U0623\U062f\U0648\U0627\U062a \U0627\U0644\U0645\U0633\U0627\U0639\U062f\U0629”;  
> ca = Utilitats;  
> cs = Utility;  
> da = “Hj\U00e6lpeprogrammer”;  
> de = Dienstprogramme;  
> el = “\U0392\U03bf\U03b7\U03b8\U03ae\U03bc\U03b1\U03c4\U03b1”;  
> en = Utilities;  
> “en\_AU” = Utilities;  
> “en\_GB” = Utilities;  
> es = Utilidades;  
> “es\_419” = Utilidades;  
> fi = “Lis\U00e4ohjelmat”;  
> fr = Utilitaires;  
> “fr\_CA” = Utilitaires;  
> he = “\U05db\U05dc\U05d9 \U05e2\U05d6\U05e8”;  
> hi = “\U092f\U0942\U091f\U093f\U0932\U093f\U091f\U0940”;  
> hr = “Uslu\U017eni programi”;  
> hu = “Seg\U00e9dprogramok”;  
> id = Utilitas;  
> it = Utility;  
> ja = “\U30e6\U30fc\U30c6\U30a3\U30ea\U30c6\U30a3”;  
> ko = “\Uc720\Ud2f8\Ub9ac\Ud2f0”;  
> ms = Kemudahan;  
> nl = “Hulpprogramma’s”;  
> no = “Verkt\U00f8y”;  
> pl = “Narz\U0119dzia”;  
> pt = “Utilit\U00e1rios”;  
> “pt\_PT” = “Utilit\U00e1rios”;  
> ro = Utilitare;  
> ru = “\U0423\U0442\U0438\U043b\U0438\U0442\U044b”;  
> sk = Utility;  
> sv = Verktyg;  
> th = “\U0e22\U0e39\U0e17\U0e34\U0e25\U0e34\U0e15\U0e35\U0e49”;  
> tr = “\U0130zlenceler”;  
> uk = “\U0423\U0442\U0438\U043b\U0456\U0442\U0438”;  
> vi = “Ti\U1ec7n \U00edch”;  
> “zh\_CN” = “\U5b9e\U7528\U5de5\U5177”;  
> “zh\_HK” = “\U5de5\U5177\U7a0b\U5f0f”;  
> “zh\_TW” = “\U5de5\U5177\U7a0b\U5f0f”;  
> };  
> kMDItemAppStoreCategoryType = “public.app-category.utilities”;  
> kMDItemCFBundleIdentifier = “org.macosforge.xquartz.X11”;  
> kMDItemContentCreationDate = “2016-09-26 07:41:50 +0000”;  
> kMDItemContentModificationDate = “2020-07-17 08:17:51 +0000”;  
> kMDItemContentType = “com.apple.application-bundle”;  
> kMDItemContentTypeTree = (  
> “com.apple.application-bundle”,  
> “com.apple.application”,  
> “public.executable”,  
> “com.apple.localizable-name-bundle”,  
> “com.apple.bundle”,  
> “public.directory”,  
> “public.item”,  
> “com.apple.package”  
> );  
> kMDItemCopyright = {  
> “” = "\U00a9 2003-2016 Apple Inc. \U00a9 2003 XFree86 Project, Inc. \U00a9 2003-2016 [X.org](http://X.org) Foundation, Inc. ";  
> };  
> kMDItemDateAdded = “2020-06-21 08:35:01 +0000”;  
> kMDItemDisplayName = {  
> “” = XQuartz;  
> };  
> kMDItemDocumentIdentifier = 0;  
> kMDItemKind = {  
> “” = Application;  
> ar = “\U062a\U0637\U0628\U064a\U0642”;  
> ca = “Aplicaci\U00f3”;  
> cs = Aplikace;  
> da = Program;  
> de = Programm;  
> el = “\U0395\U03c6\U03b1\U03c1\U03bc\U03bf\U03b3\U03ae”;  
> en = Application;  
> “en\_AU” = Application;  
> “en\_GB” = Application;  
> es = “Aplicaci\U00f3n”;  
> “es\_419” = “Aplicaci\U00f3n”;  
> fi = Appi;  
> fr = Application;  
> “fr\_CA” = Application;  
> he = “\U05d9\U05d9\U05e9\U05d5\U05dd”;  
> hi = “\U0910\U092a\U094d\U0932\U093f\U0915\U0947\U0936\U0928”;  
> hr = Aplikacija;  
> hu = “Alkalmaz\U00e1s”;  
> id = Aplikasi;  
> it = Applicazione;  
> ja = “\U30a2\U30d7\U30ea\U30b1\U30fc\U30b7\U30e7\U30f3”;  
> ko = “\Uc751\Uc6a9 \Ud504\Ub85c\Uadf8\Ub7a8”;  
> ms = Aplikasi;  
> nl = App;  
> no = Program;  
> pl = aplikacja;  
> pt = Aplicativo;  
> “pt\_PT” = “Aplica\U00e7\U00e3o”;  
> ro = “Aplica\U021bie”;  
> ru = “\U041f\U0440\U043e\U0433\U0440\U0430\U043c\U043c\U0430”;  
> sk = “Aplik\U00e1cia”;  
> sv = Program;  
> th = “\U0e41\U0e2d\U0e1e\U0e1e\U0e25\U0e34\U0e40\U0e04\U0e0a\U0e31\U0e48\U0e19”;  
> tr = Uygulama;  
> uk = “\U041f\U0440\U043e\U0433\U0440\U0430\U043c\U0430”;  
> vi = “\U1ee8ng d\U1ee5ng”;  
> “zh\_CN” = “\U5e94\U7528\U7a0b\U5e8f”;  
> “zh\_HK” = “\U61c9\U7528\U7a0b\U5f0f”;  
> “zh\_TW” = “\U61c9\U7528\U7a0b\U5f0f”;  
> };  
> kMDItemVersion = “2.7.11”;  
> }

but the metadata is not available in mdls, since the index seems to be broken:

> mdls -name kMDItemVersion /Applications/Utilities/XQuartz.app  
> kMDItemVersion = (null)

I am currently trying to rebuild the index and see if all the metadata shows up.

---

<div class="post-metadata">

**Author:** ![oliveralka](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/o/b4bc9f/32.png) [@oliveralka](https://forum.knime.com/u/oliveralka)\
**Post date:** [July 23, 2020, 8:53am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/7 "2020-07-23T08:53:56Z")

</div>

Rebuilding the Spotlight index for the whole drive did not fix the issue. Since it seems that the indexing in the “/Applications” directory was still disabled.

Careful with “sudo mdutil -E”. It will cause each local store for the volumes indicated to be erased. The stores will be rebuilt if appropriate.

To check the indexing status “sudo mdutil -s” can be used instead.

> user@MBP /Applications % sudo mdutil -E /Applications
> 
> /System/Volumes/Data/Applications:  
> 2020-07-23 10:40:51.171 mdutil[41004:1597023] mdutil disabling Spotlight: /System/Volumes/Data/Applications → kMDConfigSearchLevelFSSearchOnly  
> Indexing disabled.

Switching on indexing:

> user@MBP /Applications % sudo mdutil -i on /Applications
> 
> /System/Volumes/Data/Applications:  
> Indexing enabled.

Now “mdls” reports the all metadata entries and the KNIME is able to  
confirm the R installation and runs without any issues.

> user@MBP Utilities % mdls XQuartz.app
> 
> \_kMDItemDisplayNameWithExtensions = “XQuartz.app”  
> kMDItemAlternateNames = (  
> “XQuartz.app”  
> )  
> kMDItemAppStoreCategory = “Utilities”  
> kMDItemAppStoreCategoryType = “public.app-category.utilities”  
> kMDItemCFBundleIdentifier = “org.macosforge.xquartz.X11”  
> kMDItemContentCreationDate = 2016-09-26 07:41:50 +0000  
> kMDItemContentCreationDate\_Ranking = 2016-09-26 00:00:00 +0000  
> kMDItemContentModificationDate = 2020-07-23 08:23:54 +0000  
> kMDItemContentModificationDate\_Ranking = 2020-07-23 00:00:00 +0000  
> kMDItemContentType = “com.apple.application-bundle”  
> kMDItemContentTypeTree = (  
> “com.apple.application-bundle”,  
> “com.apple.application”,  
> “public.executable”,  
> “com.apple.localizable-name-bundle”,  
> “com.apple.bundle”,  
> “public.directory”,  
> “public.item”,  
> “com.apple.package”  
> )  
> kMDItemCopyright = "© 2003-2016 Apple Inc. © 2003 XFree86 Project, Inc. © 2003-2016 [X.org](http://X.org) Foundation, Inc. "  
> kMDItemDateAdded = 2020-06-21 08:35:01 +0000  
> kMDItemDateAdded\_Ranking = 2020-06-21 00:00:00 +0000  
> kMDItemDisplayName = “XQuartz.app”  
> kMDItemDocumentIdentifier = 0  
> kMDItemFSContentChangeDate = 2020-07-23 08:23:54 +0000  
> kMDItemFSCreationDate = 2016-09-26 07:41:50 +0000  
> kMDItemFSCreatorCode = “”  
> kMDItemFSFinderFlags = 0  
> kMDItemFSHasCustomIcon = 0  
> kMDItemFSInvisible = 0  
> kMDItemFSIsExtensionHidden = 0  
> kMDItemFSIsStationery = 0  
> kMDItemFSLabel = 0  
> kMDItemFSName = “XQuartz.app”  
> kMDItemFSNodeCount = 1  
> kMDItemFSOwnerGroupID = 0  
> kMDItemFSOwnerUserID = 0  
> kMDItemFSSize = 1  
> kMDItemFSTypeCode = “”  
> kMDItemInterestingDate\_Ranking = 2020-07-23 00:00:00 +0000  
> kMDItemKind = “Application”  
> kMDItemLogicalSize = 7949322  
> kMDItemPhysicalSize = 8499200  
> kMDItemVersion = “2.7.11”

I hope that this helps other people in the future!

Cheers  
Oliver

---

<div class="post-metadata">

**Author:** ![ipazin](https://forum-cdn.knime.com/user_avatar/forum.knime.com/ipazin/32/806_2.png) [@ipazin](https://forum.knime.com/u/ipazin)\
**Post date:** [July 23, 2020, 12:18pm UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/8 "2020-07-23T12:18:34Z")

</div>

Hi @oliveralka,

glad you figured it out and it’s working now 👍

Br,  
Ivan

---

<div class="post-metadata">

**Author:** ![Mark\_Ortmann](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/bc79bd/32.png) [@Mark\_Ortmann](https://forum.knime.com/u/Mark_Ortmann)\
**Post date:** [July 26, 2020, 9:44am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/9 "2020-07-26T09:44:51Z")

</div>

Awesome that you were able to fix the problem and thanks a lot for sharing your insides with us!

Best  
Mark

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [August 2, 2020, 9:44am UTC](https://forum.knime.com/t/r-cannot-be-initialized-macos-10-15-5-knime-4-1-3/25324/10 "2020-08-02T09:44:52Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
