Build Duplicacy from source

Duplicacy is written in Go. If you have Go installed you can run the following command to build from the latest source:

The following information is not currently accurate. See this post from the developer.

go get -u

The executable named duplicacy will then be created under $GOPATH/bin.

You can also build the executable manually after running the go get command.

cd $GOPATH/src/
go build duplicacy/duplicacy_main.go

The executable will be created under $GOPATH/src/ with the name duplicacy_main.

To download the pre-built executable, please visit the releases page and select the binary that works for your platform.

Longer explanation of how to build from source

Click here

:warning: Buliding from source from a different branch is no easy task, so i think you shouldn’t do it if you don’t know git. Just take my word on it please.

:warning: :warning: : Note that i’m not giving any tips on how to git. Git is a complex program which can’t be explained in a short tutorial. If you try it you will need help. This tutorial will not teach you git. Git is between you and google – this is why i suggested sourcetree below.

:white_check_mark: If you just want to build duplicacy without any other bells and whistles (for example just to change 1 or 2 parameters like number of retries) then you don’t need to worry: all is presented below.

  1. help:

  2. download and install go and git and make them available in PATH

  3. set $GOPATH to whichever directory you want to use as workspace (if you don’t do this, go uses as default location your_homefolder/go )

  4. in cmd run go get
    3.5 wait until the command finishes (it has to download A LOT) of sources needed for building duplicacy (all the libraries which duplicacy depends on – for each supported storage and so on)

  5. after the download is finished, cd to the folder $GOPATH/src/ (see the similarity with the above github path? → this is how go manages libraries and dependencies). There are all the sources for duplicacy.

    • 4.5 if you want to build a different branch from master, now it’s the time! you have to pull the remote branch which has the changes you need into local master – I recommend using a good GUI: Sourcetree but you can do it from cmd as well. (you monster).
    • 4.6 If you want to modify something in the sources, you should do it at this step (eg.: modify the number of retries for some storage)
  6. now that you have the sources, you have to actually compile duplicacy: again in cmd go install

  7. compiling should take no more than 10 seconds. You will find the executable file in the folder $GOPATH/bin/duplicacy.exe


Build on macOS

To build from source on macOS, Xcode must be installed because one of the dependency libraries, requires cgo for security reasons (see #136 for details). If you don’t want to install Xcode, you can switch to (the original library that was forked from) by modifying this line in src/duplicacy_keyring.go:




Build from a fork

If you fork the repository and clone the fork locally as,
please remember that duplicacy/duplicacy_main.go still imports from,
so any changes you make under will have no effect when building the executable.

Option 1

Therefore, the recommended way is to clone your fork into the original namespace:

git clone $GOPATH/src/
Option 2

There is one other option when working with a fork which is explained fully here.
The short version is:

  1. Make a normal github fork of duplicacy (so that you have;
  2. Clone original duplicacy: go get, and not your fork;
    • The repository is locally @ cd $GOPATH/src/;
  3. Add a remote to your fork in the cloned repository git remote add fork noted above;
  4. Instead of committing/pushing to origin (which is the original,
    now you use fork (which is your github repository

In this way, it is also very easy to test other people’s code: just add a new remote to $GOPATH/src/
(the original duplicacy clone) like you did in step 3. But just change the name fork to something else.

Note about the second method: there is no clone of therefore there shouldn’t exist on your disk any folder

Cross compile

An example for some NAS boxes - ARM, Debian with 64k pages:

cd $GOPATH/src/
env GOARCH=arm GOOS=linux go build -o duplicacy_linux64k_arm --ldflags "-R 65536" -v duplicacy/duplicacy_main.go

I have a builder that I use to do development that can be used with the original sources, too: GitHub - markfeit/duplicacy-dev: An easy-to-set-up environment for Duplicacy development

It’s been tested on Linux but should also work on OS X.


On MacOS there is a very quick alternative route.

  1. Install MacPorts. Likely you already have them.

  2. Update ports:

    sudo port selfupdate
    sudo port -N upgrade outdated

  3. Install go. This will bootstrap and build latest golang

    sudo port -N install golang

  4. Go get duplicacy

    go get -u

1 Like

Thank you for this! Works as expected.

1 Like