Hello, I am trying to install pmetrics from GitHub in R studio on my mac running sonoma 14.3. I keep getting the error "could not find tools necessary to compile a package".
I have run pkgbuild::check_build_tools(debug = TRUE) and brew install gcc and llvm. Unfortunately without success. How can I fix this issue? Thank you!
I've just followed the advice here and never had any problems:
https://mac.r-project.org/tools/
Install Xcode (from App store) plus GNU Fortran complier (from link on the above page) and then download the necessary binaries for libraries and tools from here:
Thank you for you reply! unfortunately it still doesn't work for me. When I run pkgbuild::check_build_tools I get this error:
Trying to compile a simple C file
Running /Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB foo.c
using C compiler: ‘clang version 4.0.1 (tags/RELEASE_401/final)’
using SDK: ‘’
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -falign-functions=64 -Wall -g -O2 -c foo.c -o foo.o
clang-4.0: warning: optimization flag '-falign-functions=64' is not supported [-Wignored-optimization-argument]
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o foo.so foo.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
-iphoneos_version_min has been renamed to -ios_version_min
ld: warning: -undefined dynamic_lookup is deprecated on iOS
-iphoneos_version_min has been renamed to -ios_version_min
ld: warning: -undefined dynamic_lookup is deprecated on iOS
dyld[18399]: missing symbol called
clang-4.0: error: unable to execute command: Abort trap: 6
clang-4.0: error: linker command failed due to signal (use -v to see invocation)
make: *** [/Library/Frameworks/R.framework/Resources/share/make/shlib.mk:10: foo.so] Error 254
Error: Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE)
to diagnose the problem.
What does the output of pkgbuild::check_build_tools(debug = TRUE) tell you?
Hi, thank you for your reply.
the output tells me the lines I have copied in my previous reply. Then it opens a dialogue on my mac:
R install build tools Building R package from source requires installation of additional build tools. Do you want to install the additional tools now?
when I click yes, I get:
Error: Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE)
to diagnose the problem.
Blockquote
Apologies...
You could try opening a terminal window in macos and running:
xcode-select --install
Hopefully that will install the command line utilities needed to allow the compiler to work.
I have tried this, but it says it's already installed:
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
when I try to use a different package I get a similar error:
using C++ compiler: ‘clang version 4.0.1 (tags/RELEASE_401/final)’
using SDK: ‘’
clang-4.0: warning: optimization flag '-falign-functions=64' is not supported [-Wignored-optimization-argument]
error: invalid value 'gnu++17' in '-std=gnu++17'
make: *** [/Library/Frameworks/R.framework/Resources/etc/Makeconf:198: irm1-mread-source.o] Error 1
Error: the model build step failed.
does this help to identify the problem?
I found the directory for build tools was incorrect in Xcode. I have restored this and now R studio is compiling correctly. Thank you for your efforts and help!
This article helped me:
Glad you got it working. My guess is installing the compliers via Homebrew (mentioned in your first post) probably meant that things were pointing to the wrong location.
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.