This guide covers the complete installation process for CopyTree on your system.
- Node.js: Version 20.0 or higher (LTS recommended)
- npm: Version 10.0 or higher (comes with Node.js)
- Git: For repository operations and Git integration features
- Operating System: macOS, Linux, or Windows with WSL
Important: CopyTree requires Node.js 20+ and uses ES Modules (ESM) only. CommonJS is not supported.
These tools enhance CopyTree's capabilities but are not required for basic operation:
- Pandoc: For advanced document conversion (DOCX, ODT, etc.)
- Tesseract: For OCR capabilities on images
# Check Node.js version
node --version # Should show v20.0.0 or higher
# Check npm version
npm --version # Should show 10.0.0 or higher
# Check Git installation
git --version # Any recent version
# Check optional tools
pandoc --version # OptionalInstall CopyTree globally to use it from any directory:
npm install -g copytreeFor project-specific use:
npm install --save-dev copytreeThen use with npx:
npx copytreeTo contribute or modify CopyTree:
git clone https://github.com/gregpriday/copytree.git
cd copytree
npm install
npm link # Makes 'copytree' command available globally# Check version
copytree --version
# Test basic functionality
copytree --display --dry-runCopyTree automatically creates required directories on first use:
~/.copytree/cache/- Cache directory (created when caching is used)~/.copytree/repos/- GitHub repository cache (created when cloning repos)
No manual setup required! Just start using CopyTree.
Alternatively, create configuration manually:
# Create config directory
mkdir -p ~/.copytree
# Create configuration file
cat > ~/.copytree/config.json << EOF
{
"app": {
"name": "CopyTree",
"version": "1.0.0",
"maxFileSize": 10485760,
"maxTotalSize": 104857600
},
"cache": {
"enabled": true,
"ttl": 3600
}
}
EOFYou can also use environment variables:
# Add to ~/.bashrc, ~/.zshrc, or equivalent
export COPYTREE_CACHE_ENABLED="true"# Install all optional dependencies
brew install pandoc
# Or install individually
brew install pandoc # Document conversion# Update package list
sudo apt update
# Install dependencies
sudo apt install pandocFollow the Ubuntu/Debian instructions within WSL.
Create a directory for custom profiles:
mkdir -p ~/.copytree/profilesCopyTree caches external repositories and transformations:
# Clear all caches
copytree cache:clear
# Clear specific caches
copytree cache:clear --transformations
copytree cache:clear --git
# View cache settings
copytree config:inspect# Copy current directory (dry run)
copytree --dry-run
# Validate configuration
copytree config:validate# Test with dry run
copytree --dry-run
# Note: Transformers are configured in profiles, not via CLI flagsFor comprehensive troubleshooting information, see our Troubleshooting Guide.
If copytree command is not found after global installation:
# Check npm global bin directory
npm bin -g
# Add to PATH if needed (add to ~/.bashrc or ~/.zshrc)
export PATH="$(npm bin -g):$PATH"
# Verify installation location
npm list -g copytreeIf you encounter EACCES errors during global installation:
# Option 1: Use npm's prefix
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Option 2: Use npx instead of global install
npm install copytree
npx copytree# Check which optional dependencies are missing
copytree config:validate
# Install missing dependencies based on your OS (see above)# Validate configuration
copytree config:validate
# Inspect configuration
copytree config:inspect
# Validate configuration
copytree config:validate# Install Node Version Manager (nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Install and use Node.js 20
nvm install 20
nvm use 20- Clipboard integration works out of the box
- Install Xcode Command Line Tools if Git is missing:
xcode-select --install
- May need to install xclip or xsel for clipboard support
- Some distributions require additional packages for Node.js
- Use WSL2 for best compatibility
- Native Windows support is experimental
- Clipboard integration requires additional setup
- Configure Claude Code Integration - Set up Claude Code integration
- Create Your First Profile - Learn about file selection profiles
- Read CLI Reference - Explore all available commands
# View help
copytree --help
# View specific command help
copytree copy --help
copytree config:validate --help
# Check documentation
See the docs/ folder in the repositoryIf you encounter issues not covered here, please:
- Check our comprehensive Troubleshooting Guide
- Visit our GitHub repository for updates and to report bugs