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.

MyConfig Demo

๐ŸŒŸ 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.2.0.tar.gz (388.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.2.0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myconfig_osx-1.2.0.tar.gz
  • Upload date:
  • Size: 388.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.2.0.tar.gz
Algorithm Hash digest
SHA256 6f9f24c0ac761c3095f7db691af1d92461891186a8010de9fffe1ea2d257b8ab
MD5 f0ae241c19822da45383cfc73e171c21
BLAKE2b-256 c0e3ad42b8b5b08b770fac393f5aebd24f28af2ed8504539d99384b1afe756a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: myconfig_osx-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 39.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 946c4e1da6c258523c61e79564553d33f196b021e6a042dd0a9ebd2fa794b109
MD5 17c85640307356ad4f7416b7c9231f57
BLAKE2b-256 5eee66d22e90b4e74894a784cbfcc94ca8bdbc75cc42de631fe82ea6b70bb383

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