Not loading RStudio, qt plugin Cocoa

I installed R and RStudio from CRAN and the RStudio website for my MacBook Pro (as anyone else would). The versions are 4.1.2 for R and 2021.09.1+372 for RStudio.

When I launch the app by clicking on the icon (the normal way to open apps), I get a blank screen before it says "R is taking longer than usual to launch". I have to force quit at this point.

If I run RStudio from the command line (by running "rstudio"), I get the following:

QFactoryLoader::QFactoryLoader() checking directory path "/Applications/RStudio.app/Contents/MacOS/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

[1]    7324 abort      rstudio

I tried installing opencv-headless using pip3 install python-opencv-headless, which didn't work. Running /Applications/RStudio.app/Contents/MacOS/RStudio --run-diagnostics gives me the following:

RStudio Version
--------------------------------------------------
2021.09.1+372


Session Information
--------------------------------------------------
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/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     

loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2   


System Information
--------------------------------------------------
sysname        : Darwin                                                                                              
release        : 21.1.0                                                                                              
version        : Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101
nodename       : MacBook-Pro.local                                                                                   
machine        : x86_64                                                                                              
login          : Kyle                                                                                                
user           : Kyle                                                                                                
effective_user : Kyle                                                                                                


Platform Information
--------------------------------------------------
OS.type    : unix
file.sep   : /
dynlib.ext : .so
GUI        : X11
endian     : little
pkgType    : mac.binary
path.sep   : :
r_arch     : 


Environment Variables
--------------------------------------------------
_                             : /Applications/RStudio.app/Contents/MacOS/RStudio
__CF_USER_TEXT_ENCODING       : 0x1F5:0x0:0x0
__CFBundleIdentifier          : com.apple.Terminal
_P9K_TTY                      : /dev/ttys000
CLICOLOR_FORCE                : 1
DISPLAY                       : /private/tmp/com.apple.launchd.ekHdTOE5Ld/org.xquartz:0
DYLD_FALLBACK_LIBRARY_PATH    : /Library/Frameworks/R.framework/Resources/lib:/Users/Kyle/lib:/usr/local/lib:/usr/lib:/lib:/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/server:/var/folders/n6/n642y1m14g7_wy5sv_qrzksh0000gn/T/rstudio-fallback-library-path-IdrY6H
EDITOR                        : vi
GIT_ASKPASS                   : rpostback-askpass
HOME                          : /Users/Kyle
HOMEBREW_CELLAR               : /opt/homebrew/Cellar
HOMEBREW_PREFIX               : /opt/homebrew
HOMEBREW_REPOSITORY           : /opt/homebrew
HOMEBREW_SHELLENV_PREFIX      : /opt/homebrew
INFOPATH                      : /opt/homebrew/share/info:
LANG                          : en_US.UTF-8
LC_CTYPE                      : en_US.UTF-8
LESS                          : -R
LN_S                          : ln -s
LOGNAME                       : *** redacted ***
LSCOLORS                      : Gxfxcxdxbxegedabagacad
MAKE                          : make
MANPATH                       : /opt/local/share/man:/opt/homebrew/share/man::
OLDPWD                        : /opt/homebrew/opt/qt/bin
P9K_SSH                       : 0
P9K_TTY                       : old
PAGER                         : less
PATH                          : /Users/Kyle/opt/anaconda3/bin:/opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin/vim:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/RStudio.app/Contents/MacOS/postback
PWD                           : *** redacted ***
PYTHONIOENCODING              : utf-8
QT_DEBUG_PLUGINS              : 1
R_BROWSER                     : /usr/bin/open
R_BZIPCMD                     : /usr/bin/bzip2
R_DOC_DIR                     : /Library/Frameworks/R.framework/Resources/doc
R_GZIPCMD                     : /usr/bin/gzip
R_HOME                        : /Library/Frameworks/R.framework/Resources
R_INCLUDE_DIR                 : /Library/Frameworks/R.framework/Resources/include
R_LIBS_SITE                   : 
R_LIBS_USER                   : ~/Library/R/x86_64/4.1/library
R_PAPERSIZE                   : a4
R_PDFVIEWER                   : /usr/bin/open
R_PLATFORM                    : x86_64-apple-darwin17.0
R_PRINTCMD                    : lpr
R_QPDF                        : /Library/Frameworks/R.framework/Resources/bin/qpdf
R_RD4PDF                      : times,inconsolata,hyper
R_SESSION_TMPDIR              : /var/folders/n6/n642y1m14g7_wy5sv_qrzksh0000gn/T//RtmpGx6waz
R_SHARE_DIR                   : /Library/Frameworks/R.framework/Resources/share
R_STRIP_SHARED_LIB            : strip -x
R_STRIP_STATIC_LIB            : strip -S
R_SYSTEM_ABI                  : macos,gcc,gxx,gfortran,gfortran
R_TEXI2DVICMD                 : /usr/local/bin/texi2dvi
R_UNZIPCMD                    : /usr/bin/unzip
R_ZIPCMD                      : /usr/bin/zip
RMARKDOWN_MATHJAX_PATH        : /Applications/RStudio.app/Contents/Resources/resources/mathjax-27
RS_PPM_FD_READ                : 14
RS_PPM_FD_WRITE               : 15
RS_RPOSTBACK_PATH             : /Applications/RStudio.app/Contents/MacOS/rpostback
RS_SHARED_SECRET              : *** redacted ***
RSTUDIO                       : 1
RSTUDIO_CONSOLE_COLOR         : 256
RSTUDIO_CONSOLE_WIDTH         : 80
RSTUDIO_FALLBACK_LIBRARY_PATH : /var/folders/n6/n642y1m14g7_wy5sv_qrzksh0000gn/T/rstudio-fallback-library-path-IdrY6H
RSTUDIO_PANDOC                : /Applications/RStudio.app/Contents/MacOS/pandoc
RSTUDIO_PROGRAM_MODE          : desktop
RSTUDIO_SESSION_PORT          : 32619
RSTUDIO_USER_IDENTITY         : Kyle
RSTUDIO_WINUTILS              : bin/winutils
SED                           : /usr/bin/sed
SHELL                         : /bin/zsh
SHLVL                         : 1
SSH_ASKPASS                   : rpostback-askpass
SSH_AUTH_SOCK                 : *** redacted ***
TAR                           : /usr/bin/tar
TERM                          : xterm-256color
TERM_PROGRAM                  : Apple_Terminal
TERM_PROGRAM_VERSION          : 443
TERM_SESSION_ID               : CD74702F-7DC8-49EB-BC4F-7D63A3286854
TEXMFHOME                     : /Users/Kyle/texmf
TMPDIR                        : /var/folders/n6/n642y1m14g7_wy5sv_qrzksh0000gn/T/
USER                          : Kyle
XPC_FLAGS                     : 0x0
XPC_SERVICE_NAME              : 0
ZSH                           : /Users/Kyle/.oh-my-zsh


R Version
--------------------------------------------------
platform       : x86_64-apple-darwin17.0
arch           : x86_64
os             : darwin17.0
system         : x86_64, darwin17.0
status         : 
major          : 4
minor          : 1.2
year           : 2021
month          : 11
day            : 01
svn rev        : 81115
language       : R
version.string : R version 4.1.2 (2021-11-01)
nickname       : Bird Hippie


R Home
--------------------------------------------------
/Library/Frameworks/R.framework/Resources


R Search Path
--------------------------------------------------
.GlobalEnv       
tools:rstudio    
package:stats    
package:graphics 
package:grDevices
package:utils    
package:datasets 
package:methods  
Autoloads        
package:base     


R Library Paths
--------------------------------------------------
/Library/Frameworks/R.framework/Versions/4.1/Resources/library


Loaded Packages
--------------------------------------------------
base      : /Library/Frameworks/R.framework/Resources/library/base                  
compiler  : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/compiler 
datasets  : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/datasets 
graphics  : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/graphics 
grDevices : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/grDevices
methods   : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/methods  
stats     : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/stats    
tools     : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/tools    
utils     : /Library/Frameworks/R.framework/Versions/4.1/Resources/library/utils    

R System Profile: /Library/Frameworks/R.framework/Resources/library/base/R/Rprofile

R Site Profile: /Library/Frameworks/R.framework/Resources/etc/Rprofile.site
--------------------------------------------------
(File does not exist)


R User Profile: /Users/Kyle/.Rprofile
--------------------------------------------------
(File does not exist)


R Site Environ: /Library/Frameworks/R.framework/Resources/etc/Renviron.site
--------------------------------------------------
(File does not exist)


R User Environ: /Users/Kyle/.Renviron
--------------------------------------------------
(File does not exist)


R Temporary Directory
--------------------------------------------------
/var/folders/n6/n642y1m14g7_wy5sv_qrzksh0000gn/T//RtmpGx6waz


Files in R Temporary Directory
--------------------------------------------------
rs-graphics-ac8b6d6a-4441-4b0c-8284-cb83bc54a2cf


Log file: /Users/Kyle/.local/share/rstudio/log/rdesktop.log
--------------------------------------------------

(Not Found)

Log file: /Users/Kyle/.local/share/rstudio/log/rsession-Kyle.log
--------------------------------------------------

2021-12-16T21:12:02.404802Z [rsession-Kyle] WARNING FileLock classes not yet initialized; please call 'FileLock::initialize()' and 'FileLock::cleanUp()' as appropriate; LOGGED FROM: static bool rstudio::core::FileLock::verifyInitialized() src/cpp/core/file_lock/FileLock.cpp:113
2021-12-16T21:12:02.409225Z [rsession-Kyle] ERROR system error 13 (Permission denied) [path: /Users/Kyle/.rstudio-desktop/log, target-path: /Users/Kyle/.local/share/rstudio/log]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::move(const rstudio::core::FilePath &, rstudio::core::FilePath::MoveType, bool) const src/cpp/shared_core/FilePath.cpp:1392; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:154
2021-12-16T21:12:02.409805Z [rsession-Kyle] WARNING Failed to migrate all user state from /Users/Kyle/.rstudio-desktop to /Users/Kyle/.local/share/rstudio; could not move log; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:176
2021-12-16T21:12:02.413235Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:12:02.413235Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:12:02.413817Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:12:02.413817Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:47:31.266824Z [rsession-Kyle] WARNING FileLock classes not yet initialized; please call 'FileLock::initialize()' and 'FileLock::cleanUp()' as appropriate; LOGGED FROM: static bool rstudio::core::FileLock::verifyInitialized() src/cpp/core/file_lock/FileLock.cpp:113
2021-12-16T21:47:31.272524Z [rsession-Kyle] ERROR system error 13 (Permission denied) [path: /Users/Kyle/.rstudio-desktop/log, target-path: /Users/Kyle/.local/share/rstudio/log]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::move(const rstudio::core::FilePath &, rstudio::core::FilePath::MoveType, bool) const src/cpp/shared_core/FilePath.cpp:1392; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:154
2021-12-16T21:47:31.272967Z [rsession-Kyle] WARNING Failed to migrate all user state from /Users/Kyle/.rstudio-desktop to /Users/Kyle/.local/share/rstudio; could not move log; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:176
2021-12-16T21:47:31.278086Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:47:31.278086Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:47:31.278894Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:47:31.278894Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:48:12.568671Z [rsession-Kyle] WARNING Abort requested; LOGGED FROM: bool rstudio::session::connection::checkForAbort(boost::shared_ptr<HttpConnection>, const boost::function<void ()>) src/cpp/session/http/SessionHttpConnectionUtils.cpp:135
2021-12-16T21:48:12.568671Z [rsession-Kyle] WARNING Abort requested; LOGGED FROM: bool rstudio::session::connection::checkForAbort(boost::shared_ptr<HttpConnection>, const boost::function<void ()>) src/cpp/session/http/SessionHttpConnectionUtils.cpp:135
2021-12-16T21:49:41.328834Z [rsession-Kyle] WARNING FileLock classes not yet initialized; please call 'FileLock::initialize()' and 'FileLock::cleanUp()' as appropriate; LOGGED FROM: static bool rstudio::core::FileLock::verifyInitialized() src/cpp/core/file_lock/FileLock.cpp:113
2021-12-16T21:49:41.333281Z [rsession-Kyle] ERROR system error 13 (Permission denied) [path: /Users/Kyle/.rstudio-desktop/log, target-path: /Users/Kyle/.local/share/rstudio/log]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::move(const rstudio::core::FilePath &, rstudio::core::FilePath::MoveType, bool) const src/cpp/shared_core/FilePath.cpp:1392; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:154
2021-12-16T21:49:41.333826Z [rsession-Kyle] WARNING Failed to migrate all user state from /Users/Kyle/.rstudio-desktop to /Users/Kyle/.local/share/rstudio; could not move log; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:176
2021-12-16T21:49:41.338387Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:49:41.338387Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:49:41.339521Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T21:49:41.339521Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T23:57:51.419933Z [rsession-Kyle] WARNING FileLock classes not yet initialized; please call 'FileLock::initialize()' and 'FileLock::cleanUp()' as appropriate; LOGGED FROM: static bool rstudio::core::FileLock::verifyInitialized() src/cpp/core/file_lock/FileLock.cpp:113
2021-12-16T23:57:51.426854Z [rsession-Kyle] ERROR system error 13 (Permission denied) [path: /Users/Kyle/.rstudio-desktop/log, target-path: /Users/Kyle/.local/share/rstudio/log]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::move(const rstudio::core::FilePath &, rstudio::core::FilePath::MoveType, bool) const src/cpp/shared_core/FilePath.cpp:1392; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:154
2021-12-16T23:57:51.427388Z [rsession-Kyle] WARNING Failed to migrate all user state from /Users/Kyle/.rstudio-desktop to /Users/Kyle/.local/share/rstudio; could not move log; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:176
2021-12-16T23:57:51.433004Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-16T23:57:51.433903Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:06:30.037093Z [rsession-Kyle] WARNING FileLock classes not yet initialized; please call 'FileLock::initialize()' and 'FileLock::cleanUp()' as appropriate; LOGGED FROM: static bool rstudio::core::FileLock::verifyInitialized() src/cpp/core/file_lock/FileLock.cpp:113
2021-12-17T00:06:30.041327Z [rsession-Kyle] ERROR system error 66 (Directory not empty) [path: /Users/Kyle/.rstudio-desktop/log, target-path: /Users/Kyle/.local/share/rstudio/log]; OCCURRED AT rstudio::core::Error rstudio::core::FilePath::move(const rstudio::core::FilePath &, rstudio::core::FilePath::MoveType, bool) const src/cpp/shared_core/FilePath.cpp:1392; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:154
2021-12-17T00:06:30.041684Z [rsession-Kyle] WARNING Failed to migrate all user state from /Users/Kyle/.rstudio-desktop to /Users/Kyle/.local/share/rstudio; could not move log; LOGGED FROM: rstudio::core::Error rstudio::core::r_util::migrateUserStateIfNecessary(rstudio::core::r_util::SessionType) src/cpp/core/r_util/RUserData.cpp:176
2021-12-17T00:06:30.044463Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:06:30.044729Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:14:15.054717Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:14:15.054717Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:14:15.057056Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:14:15.057056Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:15:28.203065Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:15:28.205438Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:15:44.587338Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T00:15:44.589339Z [rsession-Kyle] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64


User prefs: /Users/Kyle/.config/rstudio/rstudio-prefs.json
--------------------------------------------------

(Empty)

System prefs: /etc/rstudio/rstudio-prefs.json
--------------------------------------------------

(Empty)

User state: /Users/Kyle/.local/share/rstudio/rstudio-desktop.json
--------------------------------------------------

{
    "context_id": "21059C1D",
    "error_handler_type": "traceback"
}

I removed the "installed packages" and "r systems profile" sections to be able to post this.

I've already tried uninstalling R/Rstudio and reinstalling. Any advice?

What should work.

  1. Uninstall R
  2. Uninstall RStudio
  3. Install R from CRAN, use the first one if you have Intel: second if you have M1
  4. Install RStudio from RStudio

Still didn't work, same issue as above.

You shouldn't have to install XCode, but that might do the trick. The other possibility is reinstalling X11, which should be done after each macOS update. (This is what drove me to Ubuntu for R—I'm getting an M1 and plan to run R under a virtual Linux session.)

Unforunately I tried both and that didn't work. I had both installed before and just tried reinstalling them with no luck.

Well, snap! Digging deeper the whole qt business shouldn't be an issue under macOS, based on finding issues related to QFactoryLoader, which only reference nix or Win and on my own historic lack of problems on macOS with vanilla cases.

It smells like $PATH has gotten crossed somewhere among the homebrew (and Anaconda) additions to ENV. I love Anaconda as a Python package manager but have seen very few reports of anything but trouble in connection with using as an R package manager. And homebrew has been an essential for getting required libraries for compilation—until I learned better to install from source.

So here's my Hail, Mary. Create a new user: install R & RStudio. If it works, then my sense of smell is right. If it doesn't you can always nuke the unneeded user.

Hmm.. so I made a new (Standard) user, which when logged in to, has all the applications I had on my main (admin) account. Again, RStudio didn't work, and I got the same error.

Although, the error is significantly different when I run the diagnostics:

2021-12-17T03:28:46.356765Z [rsession-testing] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T03:28:46.356765Z [rsession-testing] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T03:29:40.211240Z [rsession-testing] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T03:29:40.211240Z [rsession-testing] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64
2021-12-17T03:30:52.594969Z [rsession-testing] ERROR pref_error error 1 (Error occurred while loading preferences.); OCCURRED AT rstudio::core::Error rstudio::session::prefs::PrefLayer::loadPrefsFromFile(const core::FilePath &, const core::FilePath &) src/cpp/session/prefs/PrefLayer.cpp:142; CAUSED BY: json-parse error 1 (An error occurred while parsing json. Offset: 0); OCCURRED AT virtual rstudio::core::Error rstudio::core::json::Value::parse(const char *) src/cpp/shared_core/json/Json.cpp:669; LOGGED FROM: core::Error rstudio::session::prefs::Preferences::readLayers() src/cpp/session/prefs/Preferences.cpp:64

As long as you have a disposable user, let's try

$ defaults write com.rstudio.desktop $'desktop\xb7renderingEngine' 'software'

which may work if you have a pre-2014 machine.

That didn't work either. I'm running a MacBook Pro, M1, 2020 model.

I should have my M1 in a couple of weeks. I’ll report back on my experience with a completely fresh system. Ping me or DM if you don’t see anything.

This topic was automatically closed 21 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.