This tool provides comprehensive environment checking and analysis for MacOS development setups. It helps identify configuration issues, analyzes dependencies, and maintains historical records of system health. The tool is modularly designed for better maintenance and extensibility.
mac_env_check/ # Project root
├── check_env_new.sh # Main check script
├── check_history.sh # History management utility
├── scheduled_check.sh # Automated check scheduler
├── modules/ # Core modules
│ ├── config.sh # Configuration settings
│ ├── language.sh # Language localization
│ ├── logger.sh # Logging utilities
│ ├── checks.sh # System check implementations
│ ├── reporter.sh # Report generation
│ └── analyzer.sh # Analysis functions
└── .env_check_history/ # History storage (auto-generated)
├── scheduled_check.log # Scheduled checks log
├── active_checks/ # Recent check results
│ └── mac_env_check_YYYYMMDD/ # Check result directories
└── archives/ # Compressed old results
└── mac_env_check_YYYYMMDD.tar.gz
- System information verification
- Shell environment analysis
- PATH configuration validation
- Development tools check
- Security configuration audit
- Performance monitoring
- Homebrew package analysis
- Python package dependency check
- Node.js package audit
- Version compatibility verification
- Dependency conflict detection
- Shell configuration validation
- Editor setup verification
- Git configuration check
- Network settings audit
- Security settings verification
{PREFIX}_{TIMESTAMP}_{SUFFIX}/
├── logs/
│ ├── 01_system_info.log # System information
│ ├── 02_shell_env.log # Shell environment
│ ├── 03_path_config.log # PATH configuration
│ ├── 04_homebrew.log # Homebrew packages
│ ├── 05_dev_tools.log # Development tools
│ ├── 06_python_env.log # Python environment
│ ├── 07_node_env.log # Node.js environment
│ ├── 08_editor_config.log # Editor configuration
│ ├── 09_git_config.log # Git configuration
│ ├── 10_disk_space.log # Disk space usage
│ ├── 11_network.log # Network settings
│ ├── 12_security.log # Security checks
│ ├── 13_dependencies.log # Dependency analysis
│ ├── 14_conflicts.log # Conflict detection
│ ├── 15_performance.log # Performance metrics
│ └── errors.log # Error records
├── analysis/
│ ├── analysis_report.md # Detailed analysis
│ ├── statistics.json # Statistical data
│ └── trends.md # Historical trends
├── index.html # Interactive report
└── summary.txt # Executive summary
- Error pattern analysis
- Warning category statistics
- Configuration issue tracking
- Historical trend analysis
- Component status overview
- Performance metrics tracking
- Clone the repository:
git clone https://github.com/yourusername/mac_env_check.git
cd mac_env_check- Set up the directory structure:
# Create history directories
mkdir -p .env_check_history/{active_checks,archives}- Set execution permissions:
chmod +x check_env_new.sh check_history.sh scheduled_check.sh
chmod +x modules/*.sh- Install dependencies:
brew install jq # Required for JSON processingThe tool supports multilingual output. You can switch between languages using:
# Initialize language module
source ~/Scripts/env_check/modules/language.sh
# Switch to Chinese
set_language zh
# Switch to English
set_language enLanguage settings affect:
- All check process outputs
- Generated reports
- Error and warning messages
- HTML report interface
The language preference is stored in ~/.env_check_config/language and persists between sessions.
# Run environment check
cd ~/Scripts/env_check
./check_env_new.sh
# View check history
./check_history.sh
# Run analysis only
./check_env_new.sh -aOptions:
-n, --name PREFIX Set custom prefix for log files
-s, --suffix SUFFIX Set custom suffix for log files
-k, --keep DAYS Keep logs for specified number of days (default: 30)
-a, --analyze-only Only analyze existing logs without running checks
-h, --help Show this help message# Edit crontab
crontab -e
# Monthly check (1st of each month at 9 AM)
0 9 1 * * ~/Scripts/env_check/scheduled_check.sh
# Weekly check (Every Monday at 9 AM)
0 9 * * 1 ~/Scripts/env_check/scheduled_check.sh# View current schedule
crontab -l
# Remove scheduled checks
crontab -l | grep -v "scheduled_check.sh" | crontab -# View history summary
./check_history.sh
# View specific check result
ls -l ~/.env_check_history/active_checks/
# View archived checks
ls -l ~/.env_check_history/archives/# Clean old archives (older than specified days)
find ~/.env_check_history/archives -name "*.tar.gz" -mtime +90 -delete
# Manually archive a check result
tar czf ~/.env_check_history/archives/check_result.tar.gz \
~/.env_check_history/active_checks/check_result/- Navigable interface for all check results
- Color-coded status indicators
- Quick access to detailed logs
- Real-time summary dashboard
- Executive summary of all checks
- Critical issues and warnings
- Component status overview
- Recommended actions
- Comprehensive markdown analysis report
- JSON-formatted statistics
- Historical trend analysis
- Performance metrics over time
- Configurable retention period (default: 30 days)
- Automatic archiving of old logs
- Compressed storage for space efficiency
- Archives stored in ~/.env_check_history/archives/
- Compressed using tar.gz format
- Indexed for easy retrieval
- Maintains system state changes over time
- Tracks error and warning trends
- Records performance metrics history
- Provides component status evolution
- Permission Denied
chmod +x ~/Scripts/env_check/*.sh
chmod +x ~/Scripts/env_check/modules/*.sh- Missing Dependencies
brew install jq # Required for JSON processing- Module Not Found
# Verify module directory structure
ls -l ~/Scripts/env_check/modules/- History Access Issues
# Check history directory permissions
ls -la ~/.env_check_history/
# Fix permissions if needed
chmod -R 755 ~/.env_check_history/- Scheduled Check Issues
# Check crontab entries
crontab -l
# Verify script permissions
ls -l ~/Scripts/env_check/scheduled_check.sh
# Check scheduled check log
tail ~/.env_check_history/scheduled_check.log- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.