# Parallel Workers Running MS Windows via Wine

# Introduction

This vignette shows how to set up parallel workers running R for MS Windows via Wine (https://www.winehq.org/) on Linux and macOS. This can be useful when we need to run R code or call R packages that work only on MS Windows.

The below instructions assume that you already have Wine installed.

## Install R for MS Windows 11

To install R for MS Windows in Wine, first configure Wine to use Windows 11;

    $ winecfg /v win11
    $ winecfg /v
    win11

Then, install R for Windows in Wine, by:

    $ wget https://cran.r-project.org/bin/windows/base/R-4.6.0-win.exe
    $ wine R-4.6.0-win.exe /SILENT

Finally, verify that R is available in Wine;

    $ wine "C:/Program Files/R/R-4.6.0/bin/x64/Rscript.exe" --version
    ...
    Rscript (R) version 4.6.0 (2026-04-24)

# Examples

## Example: Parallel workers running MS Windows via Wine

This example shows how to launch one worker running in Wine for Linux on the local machine.

    cl <- makeClusterPSOCK(
      1L,
      rscript = c(
        ## Silence Wine warnings
        "WINEDEBUG=fixme-all",
        "LC_ALL=en_US.UTF-8",
        ## Don't pass LC_* and R_LIBS* environments from host to Wine
        sprintf("%s=", grep("^(LC_|R_LIBS)", names(Sys.getenv()), value = TRUE)),
        "wine",
        "C:/Program Files/R/R-4.6.0/bin/x64/Rscript.exe"
      )
    )
    print(cl)
    #> Socket cluster with 1 node on host 'localhost'
    #> (R version 4.6.0 (2026-04-24 ucrt), platform x86_64-w64-mingw32)

## Example: Installing packages in Wine

We can install R packages as usual, e.g.

    void <- parallel::clusterEvalQ(cl[1], {
      chooseCRANmirror(ind = 1L)
      install.packages("future")
    })

# Appendix

## Using a personal package library in Wine

When using Wine, the system package library - the last one reported by `.libPaths()` - is owned by the users that installed R in Wine. This means that is not write protected for most users and any package can be installed there.

Sometimes its preferred to install packages to a personal package library. To do this, all we have to do is pre-create the personal package library in Wine. This can be done as:

    void <- parallel::clusterEvalQ(cl[1], {
      dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE)
    })

To validate that the personal package library exists, restart the cluster. Then call:

    parallel::clusterEvalQ(cl[1], { .libPaths() })
    [1] "C:/users/alice/AppData/Local/R/win-library/4.6"
    [2] "C:/PROG~FBU/R/R-46~UP1.0/library"

The first directory is the personal package library.

## Wine and R warnings

It might be that Wine produces warnings like:

    0128:fixme:font:find_matching_face Untranslated charset 255

and R for Windows produces a warning on:

    During startup - Warning message:
    Using locale code page other than 65001 ("UTF-8") may cause problems.

These are typically harmless. Environment variable setting `WINEDEBUG=fixme-all` should take care of the first one, and `LC_ALL=en_US.UTF-8` the second one.

## Windows-only CRAN packages

A small number of the CRAN packages install only on MS Windows. Here is how to see which they are:

    db <- read.dcf(url("https://cran.r-project.org/src/contrib/PACKAGES"))
    db <- as.data.frame(db)
    win_only <- subset(db, OS_type == "windows")
    print(win_only$Package)

As of 2026-05-22, this outputs:

     [1] "BiplotGUI"         "blatr"             "excel.link"
     [4] "hespdiv"           "KeyboardSimulator" "MDSGUI"
     [7] "MediaNews"         "R2PPT"             "R2wd"
    [10] "RDesk"             "rFUSION"           "RWinEdt"
    [13] "spectrino"         "taskscheduleR"