On 14.04.2023 the package Synth was archived, because it has a strong dependency on LowRankQP, which was archived that day. This means that Synth, along with packages that rely on it such as SCtools, tidysynth, and microsynth, cannot just be installed from CRAN or github anymore with install_packages or install_github without a few steps first.

Since there’s currently no other way of running the Synthetic Control Model in R without Synth, to install it from the archive you need to follow these steps. They are all necessary: if you skip e.g. Step 4, then Step 5 will not work!

Step 1 - Check whether you can download the packages

First we check whether the issue applies to your R version. Try the following commands. If the package(s) install without error then that’s all you need to do, and you can stop reading. Otherwise follow the next steps.


Step 2 - Installing gfortran

This is the most complicated part, as it depends on your computer, OS, and version of R. First of all, make sure your version of R is at least 4.3.0.

Follow the step below depending on your OS (MacOS or Windows) and, among Mac users, processor type. If in doubt, run the following code and it will tell you your R version, platform, and OS.


Step 2.1 - Mac users with Intel processors

You need to download and install gfortran12.2, available from this link: https://mac.r-project.org/tools/gfortran-12.2-universal.pkg.

Step 2.2 Windows users:

You will need Rtools first. Go to https://cran.r-project.org/bin/windows/Rtools/rtools43/rtools.html and download from the link Rtools43 installer.

Afterwards, go to http://www.equation.com/servlet/equation.cmd?fa=fortran and install version 12.2.0 for the right system in your case (32 or 64).

Step 2.3 Mac users with M1/M2 processors

First you will need to install the latest version of gdd which includes gfortran with Homebrew. Open a Terminal window (Press Command + Space Bar on your Mac keyboard and type in “Terminal”) and run the following code: brew install gcc.

If this returns an error (command not found: brew), then install homebrew first: https://brew.sh/, make sure to add it to your PATH (last line in the installation of Homebrew) and rerun the line above.

Then create a file ~/.R/Makevars by running the following in your R console:


Open this Makevars file (you can open it by searching your files, and opening in any text editor or even RStudio itself), paste the following three lines, and save:

FC = /opt/homebrew/Cellar/gcc/13.1.0/bin/gfortran
F77 = /opt/homebrew/Cellar/gcc/13.1.0/bin/gfortran
FLIBS = -L/opt/homebrew/Cellar/gcc/13.1.0/lib/gcc/13

Step 3 - Installing LowRankQP

Download and install latest version of LowRankQP from the archive, which is necessary for Synth to run.

url <- 'https://cran.r-project.org/src/contrib/Archive/LowRankQP/LowRankQP_1.0.5.tar.gz'
pkgFile <- 'LowRankQP_1.0.5.tar.gz'
download.file(url = url, destfile = pkgFile)

install.packages(pkgs=pkgFile, type = 'source', repos = NULL)

Delete the file:


Step 4 - Installing Synth

Download latest version of Synth from archive:

url <- "https://cran.r-project.org/src/contrib/Archive/Synth/Synth_1.1-6.tar.gz"
pkgFile <- "Synth_1.1-6.tar.gz"
download.file(url = url, destfile = pkgFile)

Install dependencies listed in the DESCRIPTION file first

install.packages(c("kernlab", "optimx", "rgenoud"))

Install Synth

install.packages(pkgs=pkgFile, type="source", repos=NULL)

Delete package tarball


Step 5 - Installing SCtools

Install dependencies listed in the DESCRIPTION file first

install.packages(c("cvTools", "furrr", "stringr","ggplot2",

Install SCtools from github:

install_github('bcastanho/SCtools', repos =NULL, force = T)

Step 6 - Test

We will now load the Synth and SCtools packages and test they work fine. Any error running the code below probably means that something went wrong earlier on. If everything goes well you should get some weights for the synthetic control and a nice plot at the end.



    foo = synth.data,
    predictors = c("X1"),
    predictors.op = "mean",
    dependent = "Y",
    unit.variable = "unit.num",
    time.variable = "year",
    special.predictors = list(
      list("Y", 1991, "mean")
    treatment.identifier = 7,
    controls.identifier = c(29, 2, 13, 17),
    time.predictors.prior = c(1984:1989),
    time.optimize.ssr = c(1984:1990),
    unit.names.variable = "name",
    time.plot = 1984:1996

Run the synth command to create the synthetic control:

synth.out <- synth(dataprep.out, Sigf.ipop=2)
tdf <- generate.placebos(dataprep.out,synth.out, Sigf.ipop = 2)
## New names:
## • `w.weight` -> `w.weight...1`
## • `w.weight` -> `w.weight...2`
## • `w.weight` -> `w.weight...3`
## • `w.weight` -> `w.weight...4`
p <- plot_placebos(tdf,discard.extreme=TRUE, mspe.limit=10, xlab='Year')