Devtools: release function error

Created on 20 Nov 2013  路  7Comments  路  Source: r-lib/devtools

release is giving errors on my machine since I updated my OSX os to Mavericks, e.g,

release(pkgname)
...
Checking pkgname with devtools
Checking for any extra files in built .tar.gz file... sh: /usr/bin/gnutar: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command

This error doesn't happen with R CMD CHECK or R CMD BUILD

My setup:
-OSX 10.9
-R 3.0.2

On twitter you asked if I was using the latest version of R, does that mean dev or stable?
I do have the latest devtools from Github, master branch.

Most helpful comment

For any future google'ers that end up here like I did, I actually had a similar issue with using devtools to install xml2 via the git repo.

This is the command and the error I was getting on Ubuntu 14.04.5 on an AWS EC2 box running Anaconda r-essentials as the R 3.2.2 distro:
devtools::install_git("git://github.com/hadley/xml2.git", branch = "master")
Installing xml2
trying URL http://cran.rstudio.com/src/contrib/BH_1.60.0-2.tar.gz
Content type application/x-gzip length 9783419 bytes (9.3 MB)
downloaded 9.3 MB
sh: 1: /bin/gtar: not found

To fix it, I tried something similar to work worked for @sckott above:
sudo ln -s /bin/tar /bin/gtar
Sure enough, symlinking gtar to the real tar did the trick, and the install went perfectly after that.

Pretty sure this has nothing to do with any bugs in devtools or xml2, but something that is wacky with my PATH and Anaconda R having something up with it, but this did the trick for us.

All 7 comments

symlinking worked for me (reference: http://apple.stackexchange.com/questions/106189/missing-usr-bin-gnutar-on-mavericks-macports/106209#106209)

sudo ln -s /usr/bin/tar /usr/bin/gnutar

Closing for now, since I don't think this is a devtools problem.

I was having the same issue, but with check():

Checking for any extra files in built .tar.gz file... sh: /usr/bin/gnutar: No such file or directory
Error in system(cmd, intern = TRUE) : error in running command

It looks like Apple got rid of /usr/bin/gnutar in OS X 10.9 (Mavericks).

This solved the problem and now check() passes with no error: http://day-to-day-stuff.blogspot.com/2013/11/installing-gnutar-on-maverick.html

I'm on OS X 10.9.1 with R 3.0.2 and devtools 1.4.1.99.

For any future google'ers that end up here like I did, I actually had a similar issue with using devtools to install xml2 via the git repo.

This is the command and the error I was getting on Ubuntu 14.04.5 on an AWS EC2 box running Anaconda r-essentials as the R 3.2.2 distro:
devtools::install_git("git://github.com/hadley/xml2.git", branch = "master")
Installing xml2
trying URL http://cran.rstudio.com/src/contrib/BH_1.60.0-2.tar.gz
Content type application/x-gzip length 9783419 bytes (9.3 MB)
downloaded 9.3 MB
sh: 1: /bin/gtar: not found

To fix it, I tried something similar to work worked for @sckott above:
sudo ln -s /bin/tar /bin/gtar
Sure enough, symlinking gtar to the real tar did the trick, and the install went perfectly after that.

Pretty sure this has nothing to do with any bugs in devtools or xml2, but something that is wacky with my PATH and Anaconda R having something up with it, but this did the trick for us.

Just to add a little more proof to what @GISDev01 mentioned (since I'm one of those future googlers), it's Sys.getenv("TAR") by way of utils::untar that's to blame, at least in my case. That getenv call returns /bin/gtar on my system for some reason. (This is all inside an Anaconda-provided R install; it returns the correct path when using the OS-provided R package.)

A simple fix that did the trick for me and doesn't require root access was just doing an export TAR=/bin/tar on the shell before launching R. Then Sys.getenv("TAR") just returns the actual environment variable instead of doing whatever magic it does to try to figure it out, and devtools can untar its dependencies during installation.

To make this even simpler for people with this issue, calling the following in R resolved this issue for me without having to exit R, change my path, sudo, etc:

Sys.setenv(TAR = "/bin/tar")

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stevecondylios picture stevecondylios  路  3Comments

coatless picture coatless  路  5Comments

shirdekel picture shirdekel  路  5Comments

Mullefa picture Mullefa  路  6Comments

rz1988 picture rz1988  路  4Comments