Error in R-studio-- new user.

I am very new to R-studio and I am having a lot of trouble knitting my document. I just got a new computer (I have a macbook pro with an m2 chip) to use for my coding//stats class and it is giving me a lot of issues. The professor and a few other people don't know why this error is occurring.

sh: /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Bad CPU type in executable Error in strsplit(info, "\n")[[1]] : subscript out of bounds Calls: ... pandoc_available -> find_pandoc -> lapply -> FUN -> get_pandoc_version In addition: Warning message: In system(paste(shQuote(path), "--version"), intern = TRUE) : running command ''/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc' --version' had status 126 Execution halted.

I tried to run this pandoc_available - > find_pandoc -> lapply -> FUN -> get_pandoc_version but it did not solve the issue.

I would really appreciate the help.

Re-install RStudio Desktop IDE which will give you either the Silicon version or the Rosetta version. It looks like you have the Intel version installed.

@technocrat RStudio Desktop installers have been universal installers for a while.

OTOH, the pandoc binary might be Intel, apparently, and the problem is that recently Apple does not include Rosetta in the OS. Run this from a terminal to install Rosetta, and then pandoc should work:

softwareupdate --install-rosetta --agree-to-license
2 Likes

I'm surprised RStudio lets {quarto} squirrel away pandoc in its tree.

/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc:

RStudio has bundled pandoc for a while. Now that it also bundles quarto and quarto needs pandoc anyway, it can just use pandoc from the embedded quarto.

And yeah, in the latest RStudio release pandoc is x86_64:

❯ file /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc
/Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/pandoc: Mach-O 64-bit executable x86_64
❯ /Applications/RStudio.app/Contents/MacOS/RStudio --version
2023.06.2+561

Here is the issue in the issue tracker, btw.: RStudio latest preview can not knit on Apple silicon MacBook - Bad CPU · Issue #12280 · rstudio/rstudio · GitHub

1 Like

I had a fair amount of trouble last year and finally sorted it on my M1 with

Version 2023.03.0+386 (2023.03.0+386)
R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)
pandoc 3.1.6.2
Features: +server +lua
Scripting engine: Lua 5.4
.Renviron
RSTUDIO_PANDOC=/usr/local/bin/pandoc
RSTUDIO_QUARTO=/ usr/local/bin/quarto

and I've been hesitant to accept IDE updates since then. When I looked at the IDE code I got the impression that it was being tested on a VM rather than metal. There is an awful lot going on under the hood.

That is somewhat surprising to me., personally I never had any trouble with quarto and pandoc, I do not set env vars, etc.

The only thing I had to do is installing Rosetta, but I needed that anyway for many other things, e.g. Docker.

I am fairly sure that if you install Rosetta, then you'll be fine without additional setup.

2 Likes

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.