Developers running Google Copybara on macOS to move code between Git repositories are reporting a wave of frustrating issues — from build failures on Apple silicon to authentication errors, broken transformations, and workflows that hang without explanation. The tool, which Google uses internally to synchronize code across repositories, has become popular for cross-repo migrations, but running it reliably on a Mac requires a specific environment that many developers struggle to configure correctly.
This is a widespread reported issue across the Apple developer community, particularly after recent macOS updates and Xcode command line tool changes. If your Copybara workflow suddenly stopped working — or never worked in the first place — this guide walks through the exact fixes that resolve it on macOS Sonoma, Sequoia, and the current macOS Tahoe release.
What Causes This Issue
Copybara is a Java-based tool built with Bazel, and it depends on a chain of components that must all be present and compatible on macOS. When any link breaks, the tool fails silently or throws cryptic errors. The most common root causes reported include:
- Incorrect or missing JDK version — Copybara requires JDK 11 or newer, and Apple silicon Macs often ship with an incompatible default Java runtime.
- Bazel version mismatches after Homebrew upgrades, especially when Bazelisk isn’t installed to manage versions automatically.
- Missing or outdated Xcode Command Line Tools, which Bazel depends on for compilation.
- Git credential helper conflicts between macOS Keychain and Copybara’s Git integration.
- Rosetta 2 issues on Apple silicon when running x86-compiled dependencies.
- Permissions problems when Copybara writes to protected directories under System Integrity Protection.
- Workflow configuration errors in the
copy.bara.skyfile, particularly with Skylark syntax after tool updates.
Users in the Apple Support Community have noted that the same Copybara configuration that works on Linux CI runners often fails on local macOS environments, pointing to platform-specific environment issues rather than bugs in Copybara itself.
Step-by-Step Fixes
- Verify your Java installation. Open Terminal and run
java -version. If you see a version below 11 or the command isn’t found, install a supported JDK. The cleanest approach on macOS is Temurin via Homebrew:brew install --cask temurin. After installing, setJAVA_HOMEin your shell profile withexport JAVA_HOME=$(/usr/libexec/java_home -v 11). - Install or reinstall Bazelisk instead of Bazel directly. Bazelisk automatically fetches the correct Bazel version required by Copybara. Run
brew install bazelisk. If you previously installed Bazel through Homebrew, unlink it first withbrew unlink bazelto prevent conflicts. - Update Xcode Command Line Tools. Run
xcode-select --install. If they’re already installed but outdated, remove them withsudo rm -rf /Library/Developer/CommandLineToolsand reinstall. Confirm the path withxcode-select -p. - Clone and build Copybara fresh. Navigate to a working directory and run
git clone https://github.com/google/copybara.git, thencd copybaraandbazelisk build //java/com/google/copybara. First-time builds can take 10–15 minutes on Apple silicon. - Set up a proper Git credential helper. Copybara authenticates against remote repositories using your local Git configuration. Run
git config --global credential.helper osxkeychainand verify your SSH keys or personal access tokens work with a manualgit clonebefore running Copybara. - Test with a minimal workflow. Before debugging your production
copy.bara.sky, create a stripped-down workflow that copies a single file between two test repositories. This isolates whether the problem is environmental or configuration-specific. - Run with verbose logging. Add the flag
--verboseto your Copybara command. This exposes the underlying Git operations and Bazel steps where the failure actually occurs, rather than the generic error you see by default.
Additional Solutions
If the core setup is correct but Copybara still fails, several secondary issues frequently appear on macOS:
- Rosetta 2 for hybrid dependencies. On Apple silicon, install Rosetta with
softwareupdate --install-rosetta --agree-to-license. Some transitive Bazel dependencies still ship as x86_64 binaries. - Increase file descriptor limits. Copybara opens many files during large migrations. Add
ulimit -n 8192to your shell profile if you see “too many open files” errors. - Clear Bazel’s cache when builds behave inconsistently:
bazelisk clean --expunge. This forces a full rebuild and resolves cases where partial builds have been corrupted by a system update. - Check for Gatekeeper quarantine flags on downloaded binaries. Run
xattr -d com.apple.quarantine /path/to/binaryif macOS is blocking a Bazel-fetched tool. - Use a dedicated shell session. Environment variables set in one Terminal tab don’t always propagate. After changing
JAVA_HOMEorPATH, open a fresh Terminal window before retesting. - Pin your Copybara version. The tool is developed on a rolling basis. If a workflow worked last month and fails today, check out a specific Git tag rather than
HEADand rebuild. - Review Skylark syntax changes. Copybara’s configuration language occasionally deprecates functions. Compare your
copy.bara.skyagainst the current examples in the official repository. - Check your macOS firewall under System Settings → Network → Firewall. Copybara’s outbound Git connections can be blocked in aggressive stealth mode configurations.
When to Contact Apple Support
Most Copybara issues are third-party tooling problems, not macOS defects, so Apple Support won’t typically troubleshoot the tool itself. However, contact Apple Support if you encounter:
- Repeated kernel panics when running Bazel builds, which may indicate hardware or memory issues.
- Persistent Keychain corruption preventing Git credential storage across multiple tools, not just Copybara.
- System Integrity Protection blocking legitimate operations even after correct configuration — this can occasionally require a firmware-level reset on Apple silicon Macs.
- Xcode Command Line Tools that refuse to install through standard channels, which sometimes points to a broken software update subsystem.
For Copybara-specific bugs, file an issue on the project’s GitHub repository. Apple Developer Support is a better route if the underlying macOS toolchain — clang, git, or the JDK provided through Xcode — is producing unexpected behavior across multiple projects.
FAQ
Does Copybara officially support macOS? Copybara is developed primarily for Linux, but it builds and runs on macOS when the correct JDK and Bazel versions are installed. Google does not publish official macOS binaries, so building from source is expected.
Why does my build succeed but the workflow does nothing? This usually means your copy.bara.sky defines a workflow that Copybara doesn’t recognize, or the origin and destination point to the same commit. Run with --verbose and check that the workflow name matches what you pass on the command line.
Can I run Copybara inside Docker on macOS instead? Yes, and many developers find this easier than maintaining a native toolchain. Use a Linux-based container with OpenJDK 11 and Bazelisk preinstalled. Performance on Apple silicon is acceptable through Docker Desktop’s virtualization.
Why does authentication fail even though Git works? Copybara sometimes bypasses the system credential helper when spawning subprocesses. Configure a personal access token directly in the remote URL, or use SSH keys with an ssh-agent that’s active in your shell session.
Is there a GUI or simpler alternative? Copybara is intentionally a command-line tool for reproducible migrations. For one-off code moves, git filter-repo or git subtree are lighter alternatives that don’t require the full Bazel toolchain.







































