lima-vm/lima · error

rsync not found on host: %w

Error message

rsync not found on host: %w

What it means

newRsyncTool wraps the result of exec.LookPath("rsync"): if the rsync binary cannot be located on the host's PATH, construction fails with this error. It is thrown eagerly when a caller (e.g. copytool.New) requests the rsync backend so the failure surfaces before any copy operation begins.

Source

Thrown at pkg/copytool/rsync.go:27

	"os/exec"
	"strings"

	"al.essio.dev/pkg/shellescape"
	"github.com/sirupsen/logrus"

	"github.com/lima-vm/lima/v2/pkg/limatype"
	"github.com/lima-vm/lima/v2/pkg/sshutil"
)

type rsyncTool struct {
	toolPath string
	Options  *Options
}

func newRsyncTool(opts *Options) (*rsyncTool, error) {
	toolPath, err := exec.LookPath("rsync")
	if err != nil {
		return nil, fmt.Errorf("rsync not found on host: %w", err)
	}
	return &rsyncTool{toolPath: toolPath, Options: opts}, nil
}

func (t *rsyncTool) Name() string {
	return t.toolPath
}

func (t *rsyncTool) IsAvailableOnGuest(ctx context.Context, paths []string) bool {
	copyPaths, err := parseCopyPaths(ctx, paths)
	if err != nil {
		logrus.Debugf("failed to parse copy paths for rsync availability check: %v", err)
		return false
	}
	instances := make(map[string]*limatype.Instance)

	for _, cp := range copyPaths {
		if cp.IsRemote {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Install rsync on the host (apt/dnf/brew install rsync) and verify with `command -v rsync`.
  2. Ensure the directory containing rsync is in PATH for the process running limactl (export PATH=...).
  3. Use an alternative copy backend (e.g. scp) if rsync is not needed.

Example fix

// before: fails with 'rsync not found on host'
cpTool, err := copytool.New(ctx, inst, nil)
// after: ensure rsync exists before invoking, or fall back
if _, err := exec.LookPath("rsync"); err != nil {
    os.Setenv("PATH", "/usr/bin:/usr/local/bin:"+os.Getenv("PATH"))
}
cpTool, err := copytool.New(ctx, inst, nil)
Defensive patterns

Strategy: validation

Validate before calling

if _, err := exec.LookPath("rsync"); err != nil {
    return fmt.Errorf("prerequisite missing: install rsync on host: %w", err)
}

Try / catch

cpTool, err := copytool.New(ctx, inst, nil)
if err != nil && strings.Contains(err.Error(), "rsync not found on host") {
    // fall back to another backend or surface an install hint
}
return err

Prevention

When it happens

Trigger: Calling copytool.New (or NewRsyncTool path) when `rsync` is not installed on the host, is not on PATH, or PATH is stripped in the executing environment (systemd services, GUI apps, containers).

Common situations: Minimal CI containers or slim Linux distros without rsync installed; running limactl via cron/systemd where PATH lacks /usr/bin set up incorrectly; macOS users who removed rsync (removed from macOS 15 base expectations) or use Homebrew rsync not on PATH.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/91f0dc430881fcca. Report an issue: GitHub.