⚙️ ConfigSync

A command-line tool for managing macOS application settings and configurations with centralized storage and syncing across multiple Mac systems.

Go
macOS
CLI
Symlinks
YAML
Testing
Homebrew
Git
Nicholas Adamou
·17 min read
🖼️
Image unavailable

Introduction

Managing application configurations across multiple Mac systems has always been a tedious and error-prone process. Whether you're setting up a new development machine, maintaining consistency across team environments, or simply wanting to backup your carefully crafted settings, the traditional approach involves manual copying, configuration drift, and the constant fear of losing important customizations.

ConfigSync eliminates these challenges by providing a comprehensive command-line tool that centralizes, manages, and synchronizes macOS application settings across multiple systems. With smart auto-discovery, safe deployment mechanisms, and robust backup systems, ConfigSync transforms configuration management from a chore into an automated, reliable process.

Why ConfigSync?

ConfigSync addresses several critical pain points in macOS configuration management:

The Configuration Management Challenge

Modern macOS development environments involve dozens of applications, each with their own configuration files scattered across various system directories. From Visual Studio Code settings and iTerm2 preferences to SSH configurations and Git settings, keeping these synchronized across multiple machines is a nightmare without proper tooling.

Consistency Across Systems

ConfigSync ensures that your development environment remains consistent whether you're working on your primary machine, a fresh laptop, or helping a teammate set up their environment. By storing configurations in a centralized location and using symlinks, any changes made to application settings are immediately reflected across all managed systems.

Safe Configuration Management

Unlike simple file copying or manual synchronization, ConfigSync provides comprehensive backup mechanisms, checksum validation, and rollback capabilities. Every operation is logged, and the system maintains integrity checks to ensure your configurations remain intact and recoverable.

Core Architecture

ConfigSync's architecture is built around several key components that work together to provide a seamless configuration management experience:

Directory Structure

ConfigSync organizes all managed configurations in a structured hierarchy that mirrors macOS's native configuration layout:

Dynamic Application Discovery & Configuration Management

ConfigSync's most innovative feature is its intelligent, multi-layered discovery system that automatically identifies installed applications and dynamically locates their configuration files across macOS's complex directory structure. Unlike static configuration tools that rely on hardcoded paths, ConfigSync adapts to each system's unique setup and application versions.

Multi-Method Discovery Engine

ConfigSync employs a sophisticated discovery engine that combines multiple detection methods to ensure comprehensive application coverage:

1. System Profiler Integration

ConfigSync leverages macOS's built-in system_profiler command to enumerate all installed applications with comprehensive metadata:

# ConfigSync internally executes commands like:
system_profiler SPApplicationsDataType -json

This provides:

  • Application bundle identifiers (e.g., com.microsoft.VSCode)
  • Installation paths and versions
  • Application signatures and metadata
  • Launch services registration data

2. Spotlight Search Integration

Using mdfind (Spotlight's command-line interface), ConfigSync performs intelligent searches across the entire filesystem:

# Search for application bundles
mdfind "kMDItemContentType == 'com.apple.application-bundle'"

# Find specific app configurations
mdfind "kMDItemDisplayName == 'Visual Studio Code'"

3. Intelligent Directory Scanning

ConfigSync systematically scans known application installation directories with recursive pattern matching:

  • /Applications - Standard app installations
  • ~/Applications - User-specific applications
  • /System/Applications - System applications
  • /System/Library/CoreServices - Core system utilities
  • /usr/local/bin - Command-line tools and utilities

Dynamic Configuration Pattern Detection

Once applications are discovered, ConfigSync employs advanced pattern recognition to locate their configuration files across macOS's diverse storage locations:

Smart Configuration Storage Strategy

ConfigSync doesn't just copy configuration files—it intelligently categorizes and stores them based on their type and importance:

Configuration File Classification

  1. Core Preferences (.plist files)

    # Example: Visual Studio Code preferences
    ~/Library/Preferences/com.microsoft.VSCode.plist → ~/.configsync/store/Library/Preferences/
    
  2. Application Support Data

    # Example: VS Code extensions and settings
    ~/Library/Application Support/Code/ → ~/.configsync/store/Library/Application Support/Code/
    
  3. Sandboxed App Containers

    # Example: 1Password app data
    ~/Library/Containers/com.1password.1password/ → ~/.configsync/store/Containers/com.1password.1password/
    
  4. XDG Configuration Directories

    # Example: Git and SSH configurations
    ~/.config/git/ → ~/.configsync/store/.config/git/
    ~/.ssh/ → ~/.configsync/store/.config/ssh/
    

Advanced Discovery Process

ConfigSync's storage system goes beyond simple file copying by implementing intelligent symlink management that maintains live connections between applications and their centralized configurations:

Dynamic Configuration Rules Engine

ConfigSync uses a sophisticated rules engine to determine how different types of applications should be handled:

# Example from ConfigSync's internal rules
applications:
  "Visual Studio Code":
    bundle_id: "com.microsoft.VSCode"
    config_paths:
      - path: "~/Library/Preferences/com.microsoft.VSCode.plist"
        type: "preferences"
        critical: true
      - path: "~/Library/Application Support/Code/User/settings.json"
        type: "user_settings"
        critical: true
      - path: "~/Library/Application Support/Code/User/keybindings.json"
        type: "keybindings"
        critical: false
    backup_strategy: "full"
    symlink_mode: "file_level"

Adaptive Configuration Detection

ConfigSync adapts to different application architectures and storage patterns:

  1. Legacy Applications (Pre-sandboxing)

    • Direct preference files in ~/Library/Preferences/
    • Application support in ~/Library/Application Support/
    • Simple bundle ID-based detection
  2. Sandboxed Applications (Modern macOS apps)

    • Isolated containers in ~/Library/Containers/
    • Group containers for shared data
    • Complex permission handling
  3. Cross-Platform Applications

    • XDG-compliant configurations in ~/.config/
    • Dotfiles in home directory
    • Multi-platform compatibility considerations
  4. Command-Line Tools

    • Configuration files in ~/.config/toolname/
    • Dotfiles like .gitconfig, .zshrc
    • Tool-specific discovery patterns

Supported Applications with Dynamic Discovery

ConfigSync's built-in application database includes detailed configuration patterns for popular applications, but it can also dynamically adapt to unknown applications:

Development Tools:

  • Visual Studio Code (settings.json, keybindings.json, extensions, snippets)
  • Sublime Text (user packages, settings, key bindings)
  • iTerm2 (terminal preferences, profiles, color schemes)
  • Git (global configuration, SSH keys, Git hooks)
  • Xcode (preferences, templates, code snippets)

Browsers:

  • Google Chrome (preferences, bookmarks, extensions data)
  • Firefox (profiles, preferences, user.js customizations)
  • Safari (preferences, reading list, extensions)

Productivity Apps:

  • 1Password (both v7 and v8, including browser integration)
  • Alfred (workflows, preferences, clipboard history)
  • Rectangle/Magnet (window management rules and shortcuts)
  • Slack/Discord (workspace settings, notification preferences)
  • Notion (workspace data and preferences)

System Utilities:

  • Finder (view preferences, sidebar settings)
  • Dock (position, size, hidden apps)
  • Bartender (menu bar organization)
  • CleanMyMac X (scan preferences and settings)

Real-Time Configuration Tracking

ConfigSync doesn't just manage static configurations—it provides real-time tracking and monitoring of configuration changes across all managed applications:

Configuration Registry Deep Dive

The ~/.configsync/config.yaml file serves as the central registry, containing detailed metadata about each managed application:

# ConfigSync Configuration Registry Example
version: "1.0"
last_updated: "2024-09-19T14:30:45Z"
system_info:
  hostname: "MacBook-Pro"
  os_version: "14.6.1"
  configsync_version: "1.2.0"

applications:
  vscode:
    display_name: "Visual Studio Code"
    bundle_id: "com.microsoft.VSCode"
    version: "1.84.2"
    install_path: "/Applications/Visual Studio Code.app"
    status: "active"
    last_synced: "2024-09-19T14:25:30Z"
    configurations:
      - path: "~/Library/Preferences/com.microsoft.VSCode.plist"
        type: "preferences"
        size_bytes: 2048
        checksum_sha256: "a1b2c3d4e5f6..."
        symlink_status: "active"
        backup_count: 5
      - path: "~/Library/Application Support/Code/User/settings.json"
        type: "user_settings"
        size_bytes: 15672
        checksum_sha256: "f6e5d4c3b2a1..."
        symlink_status: "active"
        last_modified: "2024-09-19T12:45:15Z"

  git:
    display_name: "Git"
    type: "cli_tool"
    version: "2.42.0"
    status: "active"
    configurations:
      - path: "~/.gitconfig"
        type: "global_config"
        symlink_status: "active"
        contains_secrets: false
      - path: "~/.ssh/config"
        type: "ssh_config"
        symlink_status: "active"
        contains_secrets: true
        backup_encryption: true

Intelligent Change Detection

ConfigSync monitors configuration changes through multiple mechanisms:

Configuration Sync Process

The synchronization process is the heart of ConfigSync, ensuring that all managed applications maintain consistent configurations through safe symlink management:

Deployment Workflow

ConfigSync's deployment system enables seamless configuration migration between Mac systems through secure bundle creation and validation:

Command Architecture

ConfigSync provides a comprehensive CLI interface organized into logical command groups:

Quality Assurance & Testing

ConfigSync maintains enterprise-grade reliability through comprehensive testing and quality assurance measures:

Test Coverage Metrics

  • 75%+ Overall Coverage: Extensive test suites across all core modules
  • Integration Tests: Full workflow testing including CLI commands
  • Unit Tests: Individual component testing with mocked dependencies
  • Benchmark Tests: Performance testing for critical operations
  • Cross-platform Testing: Verified on Intel and Apple Silicon Macs

Quality Assurance Features

Installation & Getting Started

ConfigSync offers multiple installation methods to suit different preferences and workflows:

# Add the DotBrains tap and install
brew install dotbrains/tap/configsync

# Verify installation
configsync --version

Quick Start Workflow

# Initialize ConfigSync
configsync init

# Auto-discover and add applications
configsync discover --auto-add

# Check what's being managed
configsync status

# Sync all configurations
configsync sync

# Create a backup
configsync backup

# Export for deployment to another Mac
configsync export --output my-configs.tar.gz

Advanced Features

Shell Completion

ConfigSync provides intelligent shell completion for all major shells:

# Bash completion
configsync completion bash > /usr/local/etc/bash_completion.d/configsync

# Zsh completion (oh-my-zsh)
mkdir -p ~/.oh-my-zsh/completions
configsync completion zsh > ~/.oh-my-zsh/completions/_configsync

# Fish completion
configsync completion fish > ~/.config/fish/completions/configsync.fish

Selective Operations

ConfigSync supports fine-grained control over which applications and configurations are managed:

# Export only specific applications
configsync export --apps "vscode,git,iterm2"

# Backup with validation and cleanup
configsync backup --validate --keep-days 30

# Sync with dry-run preview
configsync sync --dry-run

# Force deployment overriding conflicts
configsync deploy --force

Use Cases

ConfigSync excels in several key scenarios:

Development Team Standardization

Ensure consistent development environments across team members by sharing configuration bundles that include standardized editor settings, Git configurations, and development tool preferences.

Machine Migration

Seamlessly transfer your entire configuration setup when upgrading to a new Mac or setting up additional development machines.

Backup & Recovery

Maintain versioned backups of all your application configurations with checksum validation, providing confidence that your settings are always recoverable.

Environment Experimentation

Safely experiment with new application configurations knowing that you can always roll back to previous working states through the comprehensive backup and restore system.

Conclusion

ConfigSync transforms macOS configuration management from a manual, error-prone process into an automated, reliable system. By combining intelligent discovery, safe symlink management, comprehensive backup systems, and seamless deployment workflows, it provides everything needed to maintain consistent development environments across multiple Mac systems.

Whether you're managing configurations for yourself, your development team, or deploying to new systems, ConfigSync offers the reliability, safety, and automation needed to focus on what matters most: your work, not your configuration management.

Ready to simplify your macOS configuration management? Get started with ConfigSync today by visiting the GitHub repository and following the installation guide.

If you liked this project.

You will love these as well.