Problem installing dplyr

Error Information:

Description of issue -
Cannot install/load dplyr package into Rstudio

Steps taken so far -

install.packages("dplyr")
returns the error:

5 errors generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘dplyr’

  • removing ‘/usr/local/lib/R/3.6/site-library/dplyr’
    Warning in install.packages :
    installation of package ‘dplyr’ had non-zero exit status

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: 1.2.5033
  • OS Version: macOS Catalina 10.15.3
  • R Version: 3.6.1

Tried installing with dependencies = TRUE and still cannot load

Can you post the whole error message you are getting?

hi @andresrcs
This is the entire log after I run the install command:

Installing package into ‘/usr/local/lib/R/3.6/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/dplyr_0.8.5.tar.gz'
Content type 'application/x-gzip' length 1378766 bytes (1.3 MB)

downloaded 1.3 MB

  • installing source package ‘dplyr’ ...
    ** package ‘dplyr’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** libs
    clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG -I../inst/include -DRCPP_DEFAULT_INCLUDE_CALL=false -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING -DRCPP_USE_UNWIND_PROTECT -DBOOST_NO_AUTO_PTR -I"/usr/local/lib/R/3.6/site-library/BH/include" -I"/usr/local/lib/R/3.6/site-library/plogr/include" -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c RcppExports.cpp -o RcppExports.o
    In file included from RcppExports.cpp:4:
    In file included from ./../inst/include/dplyr.h:4:
    In file included from ../inst/include/dplyr/main.h:6:
    In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: C++ requires a type specifier for all declarations
    int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);
    ^
    In file included from RcppExports.cpp:4:
    In file included from ./../inst/include/dplyr.h:4:
    In file included from ../inst/include/dplyr/main.h:6:
    In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
    int getsgroups_np(int *, uuid_t);
    ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
    typedef __darwin_uid_t uid_t;
    ^
    In file included from RcppExports.cpp:4:
    In file included from ./../inst/include/dplyr.h:4:
    In file included from ../inst/include/dplyr/main.h:6:
    In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
    int getwgroups_np(int *, uuid_t);
    ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
    typedef __darwin_uid_t uid_t;
    ^
    In file included from RcppExports.cpp:4:
    In file included from ./../inst/include/dplyr.h:4:
    In file included from ../inst/include/dplyr/main.h:6:
    In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
    int setsgroups_np(int, const uuid_t);
    ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
    typedef __darwin_uid_t uid_t;
    ^
    In file included from RcppExports.cpp:4:
    In file included from ./../inst/include/dplyr.h:4:
    In file included from ../inst/include/dplyr/main.h:6:
    In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
    In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
    int setwgroups_np(int, const uuid_t);
    ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 'uid_t' declared here
    typedef __darwin_uid_t uid_t;
    ^
    5 errors generated.
    make: *** [RcppExports.o] Error 1
    ERROR: compilation failed for package ‘dplyr’
  • removing ‘/usr/local/lib/R/3.6/site-library/dplyr’
    Warning in install.packages :
    installation of package ‘dplyr’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/pc/0lfpljp976ddkk6w26_s9pr80000gn/T/RtmpMXtgPi/downloaded_packages’

It seems to be an issue with your command-line tools, can you try reinstalling Xcode and the recommended development tools from CRAN?
https://cran.r-project.org/bin/macosx/tools/

@andresrcs Thank you for your quick response! I will try that

#This error when downloading devtools
ERROR: dependencies ‘usethis’, ‘DT’ are not available for package ‘devtools’

  • removing ‘/usr/local/lib/R/3.6/site-library/devtools’
    Warning in install.packages :
    installation of package ‘devtools’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/pc/0lfpljp976ddkk6w26_s9pr80000gn/T/Rtmp6vPmqV/downloaded_packages’

Have you tried installing the missing dependencies?

while trying to install "usethis", it gives similar error... is there a way to completely remove/reinstall R, Studio and all the packages?

That wouldn't solve your issue, if you remove and reinstall you would only get base R packages and you would have to start installing the other packages from zero again.
I would recommend just keep installing the missing dependencies until you get no error messages.

I am having this exact issue, and installing with dependencies has not helped.

@andresrcs I removed Rstudio and installed it using anaconda navigator. It solved my issue idk how.

Just be aware that RStudio through Anaconda is not officially supported so you might encounter problems in the future.

I faced the same problem after upgrading to macOS Catalina. Seems that there is an issue in the Xcode command line tools (MacOS.sdk15 i think).

I post one comment about how to resolve that issue here: `later` package not compiling on MacOS ("unknown type name uuid_t").

Hope that help.

This actually does look like it would help. On my computer those files are locked. I'm concerned about editing them without potentially recompiling whatever is accessing them (I also don't know how to unlock them). Thoughts?