Removing packages installed in Rstudio

I recently switched from Macports to Homebrew. That meant using a new, ‘homebrewed’ version of R, rather than a ‘macported’ one. 

I had problems, and couldn’t find anything too helpful online, so hopefully this will serve as a guide to the next person who runs across this it.

RStudio kept giving me errors about outdated packages, but I couldn’t uninstall them. I followed these instructions, but Rstudio kept saying that the relevant packages couldn’t be found.

Here’s why : Rstudio installs packages in a completely separate place than where “normal R” packages are saved. Crazy, right?

So, if you’re trying to uninstall Rstudio packages on a Mac, try this:


Will show you the different places your library is. Note the last parameter. It might look something like this: ’/Applications/’

ip <- installed.packages() <- ip[!(ip[,“Priority”] %in% c(“base”, “recommended”)), 1]

sapply(, remove.packages, ’/Applications/’)

Or replace ’/Applications/’ with whatever isn’t the first result from .libPaths().

You might have to repeat steps 2-4 a few times. Enjoy!