685 lines · 26.2 KB · Markdown
RawDownload

title: "Install" description: "Rclone Installation"

Install

Rclone is a Go program and comes as a single binary file.

Quickstart

See below for some expanded Linux / macOS / Windows instructions.

See the usage docs for how to use rclone, or run rclone -h.

Already installed rclone can be easily updated to the latest version using the rclone selfupdate command.

See the release signing docs for how to verify signatures on the release.

Script installation

To install rclone on Linux/macOS/BSD systems, run:

sudo -v ; curl https://rclone.org/install.sh | sudo bash

For beta installation, run:

sudo -v ; curl https://rclone.org/install.sh | sudo bash -s beta

Note that this script checks the version of rclone installed first and won't re-download if not needed.

Linux installation {#linux}

Precompiled binary {#linux-precompiled}

Fetch and unpack

curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64

Copy binary file

sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone

Install manpage

sudo mkdir -p /usr/local/share/man/man1
sudo cp rclone.1 /usr/local/share/man/man1/
sudo mandb

Run rclone config to setup. See rclone config docs for more details.

rclone config

macOS installation {#macos}

Installation with brew {#macos-brew}

brew install rclone

NOTE: This version of rclone will not support mount any more (see #5373). If mounting is wanted on macOS, either install a precompiled binary or enable the relevant option when installing from source.

Note that this is a third party installer not controlled by the rclone developers so it may be out of date. Its current version is as below.

Homebrew package

Installation with MacPorts {#macos-macports}

On macOS, rclone can also be installed via MacPorts:

sudo port install rclone

Note that this is a third party installer not controlled by the rclone developers so it may be out of date. Its current version is as below.

MacPorts port

More information on macports.org.

Precompiled binary, using curl {#macos-precompiled}

To avoid problems with macOS gatekeeper enforcing the binary to be signed and notarized it is enough to download with curl.

Download the latest version of rclone.

cd && curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip

Unzip the download and cd to the extracted folder.

unzip -a rclone-current-osx-amd64.zip && cd rclone-*-osx-amd64

Move rclone to your $PATH. You will be prompted for your password.

sudo mkdir -p /usr/local/bin
sudo mv rclone /usr/local/bin/

(the mkdir command is safe to run, even if the directory already exists).

Remove the leftover files.

cd .. && rm -rf rclone-*-osx-amd64 rclone-current-osx-amd64.zip

Run rclone config to setup. See rclone config docs for more details.

rclone config

Precompiled binary, using a web browser {#macos-precompiled-web}

When downloading a binary with a web browser, the browser will set the macOS gatekeeper quarantine attribute. Starting from Catalina, when attempting to run rclone, a pop-up will appear saying:

"rclone" cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware.

The simplest fix is to run

xattr -d com.apple.quarantine rclone

Windows installation {#windows}

Precompiled binary {#windows-precompiled}

Fetch the correct binary for your processor type by clicking on these links. If not sure, use the first link.

Open this file in the Explorer and extract rclone.exe. Rclone is a portable executable so you can place it wherever is convenient.

Open a CMD window (or powershell) and run the binary. Note that rclone does not launch a GUI by default, it runs in the CMD Window.

If you are planning to use the rclone mount feature then you will need to install the third party utility WinFsp also.

Windows package manager (Winget) {#windows-chocolatey}

Winget comes pre-installed with the latest versions of Windows. If not, update the App Installer package from the Microsoft store.

To install rclone

winget install Rclone.Rclone

To uninstall rclone

winget uninstall Rclone.Rclone --force

Chocolatey package manager {#windows-chocolatey}

Make sure you have Choco installed

choco search rclone
choco install rclone

This will install rclone on your Windows machine. If you are planning to use rclone mount then

choco install winfsp

will install that too.

Note that this is a third party installer not controlled by the rclone developers so it may be out of date. Its current version is as below.

Chocolatey package

Scoop package manager {#windows-scoop}

Make sure you have Scoop installed

scoop install rclone

Note that this is a third party installer not controlled by the rclone developers so it may be out of date. Its current version is as below.

Scoop package

Package manager installation {#package-manager}

Many Linux, Windows, macOS and other OS distributions package and distribute rclone.

The distributed versions of rclone are often quite out of date and for this reason we recommend one of the other installation methods if possible.

You can get an idea of how up to date or not your OS distribution's package is here.

Packaging status

Docker installation {#docker}

The rclone developers maintain a docker image for rclone.

Note: We also now offer a paid version of rclone with enterprise-grade security and zero CVEs through our partner SecureBuild. If you are interested, check out their website and the Rclone SecureBuild Image.

These images are built as part of the release process based on a minimal Alpine Linux.

The :latest tag will always point to the latest stable release. You can use the :beta tag to get the latest build from master. You can also use version tags, e.g. :1.49.1, :1.49 or :1.

$ docker pull rclone/rclone:latest
latest: Pulling from rclone/rclone
Digest: sha256:0e0ced72671989bb837fea8e88578b3fc48371aa45d209663683e24cfdaa0e11
...
$ docker run --rm rclone/rclone:latest version
rclone v1.49.1
- os/arch: linux/amd64
- go version: go1.12.9

There are a few command line options to consider when starting an rclone Docker container from the rclone image.

  • You need to mount the host rclone config dir at /config/rclone into the Docker container. Due to the fact that rclone updates tokens inside its config file, and that the update process involves a file rename, you need to mount the whole host rclone config dir, not just the single host rclone config file.

  • You need to mount a host data dir at /data into the Docker container.

  • By default, the rclone binary inside a Docker container runs with UID=0 (root). As a result, all files created in a run will have UID=0. If your config and data files reside on the host with a non-root UID:GID, you need to pass these on the container start command line.

  • If you want to access the RC interface (either via the API or the Web UI), it is required to set the --rc-addr to :5572 in order to connect to it from outside the container. An explanation about why this is necessary can be found in an old pythonspeed.com article.

    • NOTE: Users running this container with the docker network set to host should probably set it to listen to localhost only, with 127.0.0.1:5572 as the value for --rc-addr
  • It is possible to use rclone mount inside a userspace Docker container, and expose the resulting fuse mount to the host. The exact docker run options to do that might vary slightly between hosts. See, e.g. the discussion in this thread.

    You also need to mount the host /etc/passwd and /etc/group for fuse to work inside the container.

Here are some commands tested on an Ubuntu 18.04.3 host:

# config on host at ~/.config/rclone/rclone.conf
# data on host at ~/data

# add a remote interactively
docker run --rm -it \
    --volume ~/.config/rclone:/config/rclone \
    --user $(id -u):$(id -g) \
    rclone/rclone \
    config

# make sure the config is ok by listing the remotes
docker run --rm \
    --volume ~/.config/rclone:/config/rclone \
    --user $(id -u):$(id -g) \
    rclone/rclone \
    listremotes

# perform mount inside Docker container, expose result to host
mkdir -p ~/data/mount
docker run --rm \
    --volume ~/.config/rclone:/config/rclone \
    --volume ~/data:/data:shared \
    --user $(id -u):$(id -g) \
    --volume /etc/passwd:/etc/passwd:ro --volume /etc/group:/etc/group:ro \
    --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined \
    rclone/rclone \
    mount dropbox:Photos /data/mount &
ls ~/data/mount
kill %1

Snap installation {#snap}

Get it from the Snap Store

Make sure you have Snapd installed

sudo snap install rclone

Due to the strict confinement of Snap, rclone snap cannot access real /home/$USER/.config/rclone directory, default config path is as below.

  • Default config directory:
    • /home/$USER/snap/rclone/current/.config/rclone

Note: Due to the strict confinement of Snap, rclone mount feature is not supported.

If mounting is wanted, either install a precompiled binary or enable the relevant option when installing from source.

Note that this is controlled by community maintainer not the rclone developers so it may be out of date. Its current version is as below.

rclone

Source installation {#source}

Make sure you have git and Go installed. Go version 1.26 or newer is required, the latest release is recommended. You can get it from your package manager, or download it from golang.org/dl. Then you can run the following:

git clone https://github.com/rclone/rclone.git
cd rclone
go build

This will check out the rclone source in subfolder rclone, which you can later modify and send pull requests with. Then it will build the rclone executable in the same folder. As an initial check you can now run ./rclone version (.\rclone version on Windows).

Note that on macOS and Windows the mount command will not be available unless you specify an additional build tag cmount.

go build -tags cmount

This assumes you have a GCC compatible C compiler (GCC or Clang) in your PATH, as it uses cgo. But on Windows, the cgofuse library that the cmount implementation is based on, also supports building without cgo, i.e. by setting environment variable CGO_ENABLED to value 0 (static linking). This is how the official Windows release of rclone is being built, starting with version 1.59. It is still possible to build with cgo on Windows as well, by using the MinGW port of GCC, e.g. by installing it in a MSYS2 distribution (make sure you install it in the classic mingw64 subsystem, the ucrt64 version is not compatible).

Additionally, to build with mount on Windows, you must install the third party utility WinFsp, with the "Developer" feature selected. If building with cgo, you must also set environment variable CPATH pointing to the fuse include directory within the WinFsp installation (normally C:\Program Files (x86)\WinFsp\inc\fuse).

You may add arguments -ldflags -s to omit symbol table and debug information, making the executable file smaller, and -trimpath to remove references to local file system paths. The official rclone releases are built with both of these.

go build -trimpath -ldflags -s -tags cmount

If you want to customize the version string, as reported by the rclone version command, you can set one of the variables fs.Version, fs.VersionTag (to keep default suffix but customize the number), or fs.VersionSuffix (to keep default number but customize the suffix). This can be done from the build command, by adding to the -ldflags argument value as shown below.

go build -trimpath -ldflags "-s -X github.com/rclone/rclone/fs.Version=v9.9.9-test" -tags cmount

On Windows, the official executables also have the version information, as well as a file icon, embedded as binary resources. To get that with your own build you need to run the following command before the build command. It generates a Windows resource system object file, with extension .syso, e.g. resource_windows_amd64.syso, that will be automatically picked up by future build commands.

go run bin/resource_windows.go

The above command will generate a resource file containing version information based on the fs.Version variable in source at the time you run the command, which means if the value of this variable changes you need to re-run the command for it to be reflected in the version information. Also, if you override this version variable in the build command as described above, you need to do that also when generating the resource file, or else it will still use the value from the source.

go run bin/resource_windows.go -version v9.9.9-test

Instead of executing the go build command directly, you can run it via the Makefile. The default target changes the version suffix from "-DEV" to "-beta" followed by additional commit details, embeds version information binary resources on Windows, and copies the resulting rclone executable into your GOPATH bin folder ($(go env GOPATH)/bin, which corresponds to ~/go/bin/rclone by default).

make

To include mount command on macOS and Windows with Makefile build:

make GOTAGS=cmount

There are other make targets that can be used for more advanced builds, such as cross-compiling for all supported os/architectures, and packaging results into release artifacts. See Makefile and cross-compile.go for details.

Another alternative method for source installation is to download the source, build and install rclone - all in one operation, as a regular Go package. The source will be stored it in the Go module cache, and the resulting executable will be in your GOPATH bin folder ($(go env GOPATH)/bin, which corresponds to ~/go/bin/rclone by default).

go install github.com/rclone/rclone@latest

In some situations, rclone executable size might be too big for deployment in very restricted environments when all backends with large SDKs are included. To limit binary size unused backends can be commented out in backends/all/all.go

Lines 1–500 of 685.