Error After R Update; 'lib = "C:/Program Files/R/R-3.5.0/library"' is not writable

I'm having an issue with the newest version of R that i just installed. I'm getting an error message when I tried to install devtools:

Warning in install.packages("devtools") :
'lib = "C:/Program Files/R/R-3.5.0/library"' is not writable
Error in install.packages("devtools") : unable to install packages

I'm new to R and I don't know what the next step to fix this is.

Just to get the basic diagnostics and system info out of the way, the following info is usually helpful:

RStudio Edition: (Desktop or Server)
RStudio Version:
OS Version:
R Version:
The output of sessionInfo()

However, googling around a bit for this error message related to R upgrades strongly suggests that you might not have write access to anything in C:\Program Files. If you want to install to the system library, you must run R as administrator.

From R's FAQ Docs, 2.24 Does R run under Windows Vista/7/8/Server 2008?

If you use the default Administrator account (without ‘admin approval mode’ being turned on) and ins tall/update packages (in the system area or elsewhere), no issues are known.

If you use an account in the local Administrators group in ‘admin approval mode’ (which is the intended norm under these OSes), installation will make use of ‘over-the-shoulder’ credentials. You will run into problems if you try installing (including updating) packages in the main R library. (It would be nice if at that point R could use over-the-shoulder credentials, but they apply to processes as a whole. Vista and later disallow creating .dll files in the system area without credentials.) There are several ways around this.

  • Run R with Administrator privileges in sessions where you want to install packages. (Do so by right-clicking on the R shortcut and selecting ’Run as Administrator’.)


1 Like

You can create a library directory where you have write-permission then direct R to install all packages to it. See the following link for example


Use R with administrative privilege to install the package. If you are on Windows, right click on a R (not RStudio) shortcut and select "Run as administrator". Then install your package as usual (with install.packages("devtools")). After this, you can close this session and reopen RStudio.

1 Like


I have been using RStudio for a long time now, and this error never showed up before. But for some reason, it has started showing up for my packages installation as well. Can anyone suggest me the problem my software is facing?

Thanks in advance