Skip to main content

macOS configuration backup and restore tool

Project description

MyConfig

PyPI version Downloads License: GPL v2 Python 3.8+ macOS GitHub stars Tests Coverage

A comprehensive macOS system configuration backup and restore tool.

๐ŸŒŸ Features

  • ๐Ÿ”„ Complete Backup: Supports Homebrew, VS Code, dotfiles, system preferences, and more
  • ๐Ÿ”’ Secure & Reliable: Automatically skips sensitive files and validates backup integrity
  • ๐Ÿ‘€ Preview Mode: Preview what will be backed up/restored before executing
  • ๐Ÿ“Š Progress Tracking: Real-time progress indicators and detailed status updates
  • โš™๏ธ Flexible Configuration: Multiple configuration profiles and customization options
  • ๐Ÿ”Œ Extensible: Plugin system for extending functionality
  • ๐Ÿ“‹ Self-Documenting: Auto-generated README.md for every backup with detailed manifests
  • ๐Ÿ—œ๏ธ Compression Support: Create compressed archives for easy storage and sharing
  • ๐ŸŽจ Template System: Customizable file generation using professional templates
  • ๐Ÿงช Comprehensive Testing: Unit and integration tests ensuring reliability
  • ๐Ÿ—๏ธ Modern Architecture: Class-based design with proper separation of concerns

๐Ÿš€ Quick Start

Installation

Method 1: PyPI Installation (Recommended)

# Install from PyPI
pip install myconfig-osx

# Verify installation
myconfig --version
myconfig doctor

Method 2: Development Installation

# Clone the repository
git clone https://github.com/kehr/myconfig.git
cd myconfig

# Install in development mode
pip install -e .

# Verify installation
myconfig --version
myconfig doctor

Method 3: Direct Usage (No Installation)

# Clone the repository
git clone https://github.com/kehr/myconfig.git
cd myconfig

# Set execution permissions
chmod +x bin/myconfig
chmod +x scripts/install.sh

# Use directly
./bin/myconfig --help

# Or install from source
./scripts/install.sh

Basic Usage

After Installation:

# Export current system configuration
myconfig export

# Preview export contents
myconfig --preview export

# Restore configuration from backup
myconfig restore <backup-directory>

# System health check
myconfig doctor

Direct Usage:

# Export current system configuration
./bin/myconfig export

# Preview export contents
./bin/myconfig --preview export

# Restore configuration from backup
./bin/myconfig restore <backup-directory>

# System health check
./bin/myconfig doctor

๐Ÿ“– Documentation

Detailed documentation is available in the docs directory:

๐Ÿ”ง Main Commands

Command Description
export [dir] Export configuration to specified directory
export --compress [dir] Create compressed backup archive (.tar.gz)
restore <dir> Restore configuration from backup directory
unpack <archive> Unpack compressed backup archive
doctor System environment check and diagnostics
--preview Preview mode - show what will be processed
--dry-run Test run mode - don't execute actual operations

๐Ÿ›ก๏ธ Security Features

  • Automatically skips sensitive files (SSH keys, password files, etc.)
  • Backup integrity verification and validation
  • Detailed operation logging
  • Security-filtered dotfiles export
  • Safe restoration with automatic backups of existing files

๐Ÿ“‹ Supported Components

  • System Tools: Homebrew (auto-generates Brewfile), Mac App Store applications
  • Development Environment: VS Code extensions, npm/pip packages
  • Configuration Files: Shell configs, Git settings, editor configurations
  • System Settings: macOS preferences (defaults domains)
  • Services: LaunchAgents user services

๐Ÿ“ Project Structure

myconfig/
โ”œโ”€โ”€ bin/myconfig              # Executable script
โ”œโ”€โ”€ config/                   # Configuration files
โ”‚   โ”œโ”€โ”€ config.toml          # Main configuration file
โ”‚   โ”œโ”€โ”€ defaults/            # defaults domain configurations
โ”‚   โ””โ”€โ”€ profiles/            # Configuration profiles
โ”œโ”€โ”€ docs/                    # Documentation
โ”œโ”€โ”€ src/                     # Python source package
โ”‚   โ”œโ”€โ”€ core/                # Core modules (class-based architecture)
โ”‚   โ”‚   โ”œโ”€โ”€ config.py        # Configuration management
โ”‚   โ”‚   โ”œโ”€โ”€ executor.py      # Command execution
โ”‚   โ”‚   โ”œโ”€โ”€ backup.py        # Backup orchestration
โ”‚   โ”‚   โ””โ”€โ”€ components/      # Individual backup components
โ”‚   โ”œโ”€โ”€ actions/             # Legacy action modules
โ”‚   โ”œโ”€โ”€ templates/           # File generation templates
โ”‚   โ”œโ”€โ”€ template_engine.py   # Template processing engine
โ”‚   โ”œโ”€โ”€ logger.py            # Logging configuration
โ”‚   โ”œโ”€โ”€ cli.py               # Command line interface
โ”‚   โ””โ”€โ”€ utils.py             # Utility functions
โ””โ”€โ”€ README.md               # Project documentation

๐Ÿ†• New Features

๐Ÿ“‹ Auto-Generated Documentation

Every backup now includes a comprehensive README.md with:

  • Detailed component analysis (package counts, file sizes, etc.)
  • Export statistics and metadata
  • Restore instructions and important notes
  • Professional formatting with clear organization

๐Ÿ—œ๏ธ Compression Support

# Create compressed backup
myconfig export my-backup --compress
# Creates: my-backup.tar.gz

# Unpack compressed backup
myconfig unpack my-backup.tar.gz extracted-backup

# Restore from unpacked backup
myconfig restore extracted-backup

๐ŸŽจ Template System

  • Customizable file generation using templates
  • Located in src/templates/ directory
  • Easy to modify without touching Python code
  • Supports variables, conditionals, and loops
  • Professional output formatting

๐Ÿ—‘๏ธ Uninstallation

If you need to uninstall MyConfig:

# Use uninstall script
./uninstall.sh

# Or use pip directly
pip3 uninstall myconfig

# Using Makefile
make uninstall

๐Ÿ› ๏ธ Development

# Development mode installation (editable)
pip3 install -e .

# Code formatting
make format

# Code checking
make lint

# Build package
make build

# Clean up
make clean

๐Ÿค Contributing

Issues and Pull Requests are welcome!

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Note: Run myconfig doctor (if installed) or ./bin/myconfig doctor (direct usage) to check your system environment before first use.

๐Ÿ—๏ธ Architecture

MyConfig uses a modern, class-based architecture:

  • Modular Design: Each component (Homebrew, VS Code, etc.) is a separate module
  • Abstract Base Classes: Consistent interface for all backup components
  • Template Engine: Flexible file generation system
  • Error Handling: Comprehensive error handling with graceful fallbacks
  • Logging System: Centralized logging with configurable levels
  • Configuration Management: TOML-based configuration with profiles

๐Ÿ“Š Export Example

A typical backup contains:

  • System environment information
  • Homebrew configuration (Brewfile with 16 packages, 5 casks)
  • VS Code extensions (55+ extensions)
  • Configuration files (16MB+ compressed dotfiles)
  • System preferences (15+ domains)
  • LaunchAgents (8+ services)
  • Auto-generated README.md with complete manifest
  • Metadata files (MANIFEST.json, version info)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myconfig_osx-1.1.0.tar.gz (64.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myconfig_osx-1.1.0-py3-none-any.whl (38.8 kB view details)

Uploaded Python 3

File details

Details for the file myconfig_osx-1.1.0.tar.gz.

File metadata

  • Download URL: myconfig_osx-1.1.0.tar.gz
  • Upload date:
  • Size: 64.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for myconfig_osx-1.1.0.tar.gz
Algorithm Hash digest
SHA256 d91c20e7f07c93204ebe3bd45a364a94eafae87b88b43071837986cbd4b854d8
MD5 af076e2093d3286b53d2b15a316513bf
BLAKE2b-256 3d63fe221fe271283d061c3dade8ff26b3cc0eb27887175e64625e1b74d16855

See more details on using hashes here.

File details

Details for the file myconfig_osx-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: myconfig_osx-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for myconfig_osx-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee618cc4c1b083dd2298b0cf2f368551054d3642394f28d429b41c9f688ff9e5
MD5 0a9c0f37a6de42a48e5127fe7715e572
BLAKE2b-256 de5b25b0d59b10af3d79f498ae194addc981607cd63d098d218a721c6b17cafb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page