An open API service indexing awesome lists of open source software.

https://github.com/wsmr/macos-script-bash-health_check

๐Ÿ–ฅ๏ธ Intelligent Apple macOS system health monitoring script with actionable insights, Spotlight indexing detection, and educational guidance for system administrators
https://github.com/wsmr/macos-script-bash-health_check

actionable-insights bash cpu-monitoring diagnostics health-check load-analysis macos performance shell-script spotlight system-administration system-monitoring

Last synced: 3 months ago
JSON representation

๐Ÿ–ฅ๏ธ Intelligent Apple macOS system health monitoring script with actionable insights, Spotlight indexing detection, and educational guidance for system administrators

Awesome Lists containing this project

README

          

# ๐Ÿ–ฅ๏ธ macOS Health Check

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![macOS](https://img.shields.io/badge/macOS-15.0+-blue.svg)](https://www.apple.com/macos/)
[![Shell](https://img.shields.io/badge/Shell-Bash-green.svg)](https://www.gnu.org/software/bash/)

A comprehensive, intelligent macOS system health monitoring script that provides actionable insights instead of just raw numbers.

## ๐Ÿ“‚ Repository Structure:
```
macOS-Script-Bash-health_check/
โ”œโ”€โ”€ macos_health_check.sh (Main script)
โ”œโ”€โ”€ README.md (Comprehensive documentation)
โ”œโ”€โ”€ LICENSE (MIT License)
โ”œโ”€โ”€ CHANGELOG.md ๐Ÿ“ (Version history - Professional version history and future roadmap)
โ”œโ”€โ”€ examples/ ๐Ÿ“‚ (Sample outputs - Real-world output examples that users can relate to)
โ”‚ โ”œโ”€โ”€ normal_system.txt ๐Ÿ“„ (Normal system example)
โ”‚ โ”œโ”€โ”€ spotlight_rebuilding.txt ๐Ÿ“„ (Your current situation!)
โ”‚ โ””โ”€โ”€ system_overload.txt ๐Ÿ“„ (Critical system state)
โ”œโ”€โ”€ docs/ ๐Ÿ“‚ (Additional documentation)
โ”‚ โ”œโ”€โ”€ troubleshooting.md ๐Ÿ“‹ (Comprehensive problem-solving guide)
โ”‚ โ””โ”€โ”€ advanced_usage.md ๐Ÿš€ (Automation, monitoring, and integration examples)
โ””โ”€โ”€ .github/ ๐Ÿ“‚ (New - GitHub integration)
โ”œโ”€โ”€ ISSUE_TEMPLATE.md ๐Ÿ› (Issue reporting template - Structured issue reporting)
โ””โ”€โ”€ workflows/
โ””โ”€โ”€ test.yml ๐Ÿงช (Basic testing - Automated testing and validation)
```

## ๐ŸŒŸ Features

### ๐Ÿง  Intelligent Analysis
- **Context-aware diagnostics** - Understands what's normal vs concerning
- **Load average interpretation** with CPU core context
- **Spotlight indexing detection** with progress tracking
- **System process health monitoring** with escalating alerts
- **Memory pressure analysis** with actionable thresholds

### ๐Ÿ’ก Actionable Recommendations
- **Immediate action steps** for critical issues
- **Timeline expectations** for temporary processes (like Spotlight rebuilding)
- **"Do NOT" warnings** to prevent harmful interventions
- **Severity-based color coding** with clear next steps

### ๐Ÿ“Š Comprehensive Coverage
- System overview with load analysis
- Real-time CPU usage with multi-sample accuracy
- Spotlight/indexing status and progress
- System process health checks
- Memory usage analysis
- Issue detection and classification
- System activity context
- Quick action guide

## ๐Ÿš€ Quick Start

```bash
# Clone the repository
git clone https://github.com/macOS-Script-Bash-health_check.git
cd macos-health-check

# Make the script executable
chmod +x macos_health_check.sh

# Run the health check
./macos_health_check.sh
```

## ๐Ÿ“‹ Sample Output

```
๐Ÿ–ฅ๏ธ macOS Health Check Report
Generated: Sun Aug 24 16:05:35 +0530 2025
=========================================
๐Ÿ“Š System Overview
macOS: 15.6.1
Load Averages: 12.28 (1m) 13.31 (5m) 11.34 (15m)
๐Ÿšจ System Load: 153% (OVERLOADED - System struggling)
๐Ÿ’ก Action: Identify heavy processes, consider restart if persistent

๐Ÿ” Spotlight Indexing Status
๐Ÿ’ก Spotlight is rebuilding index (high CPU is temporary)
โฐ Expected: 30-60 minutes for completion
๐ŸŒก๏ธ System may be warm during this process
โŒ Don't interrupt: Let indexing complete naturally

โœ… All system processes healthy
```

## ๐ŸŽฏ Key Benefits

### ๐Ÿ” **Smart Problem Detection**
Unlike basic system monitors, this script:
- **Distinguishes temporary from persistent issues**
- **Explains WHY metrics are high** (e.g., Spotlight rebuilding)
- **Provides context for load averages** based on your CPU core count
- **Identifies system daemon health issues** that could indicate instability

### ๐Ÿ“š **Educational Value**
- **Teaches system administration concepts**
- **Explains what metrics mean** in practical terms
- **Builds understanding** of normal vs abnormal system behavior
- **Prevents unnecessary panic** about temporary high loads

### โšก **Actionable Intelligence**
- **Immediate steps** for critical situations
- **Monitoring guidance** for elevated metrics
- **Timeline expectations** for ongoing processes
- **Prevention tips** to avoid common issues

## ๐Ÿ› ๏ธ Requirements

- **macOS 10.15+** (tested on macOS 15.6.1)
- **Bash shell** (default on macOS)
- **Basic command line tools** (`ps`, `df`, `uptime`, etc. - standard on macOS)
- **Admin privileges** for some advanced checks (script will prompt when needed)

## ๐Ÿ“– Understanding the Output

### Load Average Interpretation
```
Load Averages: 6.28 (1m) 6.61 (5m) 7.18 (15m)
CPU Cores: 8
๐Ÿ“Š System Load: 78% (ELEVATED - Normal for active use)
```
- **Percentages are calculated** based on your CPU core count
- **<60% = Healthy**, **60-80% = Elevated**, **>80% = High**, **>100% = Overloaded**

### Spotlight Status
```
๐Ÿ” Spotlight Indexing Status
๐Ÿ’ก Spotlight is rebuilding index (high CPU is temporary)
โฐ Expected: 30-60 minutes for completion
```
- **Intensive indexing is normal** after system changes
- **High CPU during rebuilding is expected**
- **Process will complete automatically**

### System Process Health
```
๐Ÿ” System Process Analysis
โœ… launchd: 0.1% CPU (NORMAL)
โŒ launchd: 26.2% CPU (HIGH)
```
- **System processes should typically use <5% CPU**
- **High system process CPU indicates potential issues**
- **Multiple elevated system processes suggest restart needed**

## ๐Ÿšจ Common Scenarios

### ๐Ÿ”ฅ High CPU from Spotlight
**What you'll see:**
- High load averages (>100%)
- Multiple `mds`, `mds_stores`, `mdworker_shared` processes
- System appears to be struggling

**Script guidance:**
- โœ… Identifies this as temporary indexing
- โฐ Provides completion timeline
- โŒ Warns against interrupting the process

### ๐Ÿ’พ Memory Pressure
**What you'll see:**
- Low memory percentage free
- High memory usage from specific apps

**Script guidance:**
- ๐ŸŽฏ Identifies memory-heavy processes
- ๐Ÿ’ก Provides cleanup recommendations
- โš ๏ธ Warns about critical memory levels

### โšก System Daemon Issues
**What you'll see:**
- High CPU from system processes (launchd, logd, etc.)
- System responsiveness issues

**Script guidance:**
- ๐Ÿšจ Flags abnormal system process behavior
- ๐Ÿ”ง Recommends system restart when multiple daemons affected
- ๐Ÿ“‹ Suggests log checking commands

## ๐Ÿ”ง Advanced Usage

### Automated Monitoring
```bash
# Run every hour and log results
echo "0 * * * * /path/to/macos_health_check.sh >> /var/log/health_check.log 2>&1" | crontab -
```

### Performance Tracking
```bash
# Create timestamped reports
./macos_health_check.sh > "health_report_$(date +%Y%m%d_%H%M%S).txt"
```

### Integration with Monitoring Systems
The script's structured output can be parsed by monitoring systems or log aggregators.

## ๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request. Some areas where contributions would be especially valuable:

- ๐ŸŽฏ **Additional system checks** (disk health, network status, etc.)
- ๐ŸŽจ **Output format options** (JSON, CSV, etc.)
- ๐Ÿ”ง **Integration helpers** for monitoring systems
- ๐Ÿ“š **Documentation improvements**
- ๐ŸŒ **Localization** for different languages

### Development Setup
```bash
git clone https://github.com/macOS-Script-Bash-health_check.git
cd macos-health-check

# Test your changes
./macos_health_check.sh

# Run with different scenarios to test logic
```

## ๐Ÿ“ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ๐Ÿ™ Acknowledgments

- Inspired by the need for **intelligent system monitoring** beyond basic metrics
- Built for **macOS system administrators** who need actionable insights
- Designed to **educate users** about their system's behavior

## โญ Star History

If this script helped you understand and fix your macOS performance issues, please consider giving it a star! โญ

## ๐Ÿ“ž Support

- ๐Ÿ› **Bug reports**: [Open an issue](https://github.com/macOS-Script-Bash-health_check/issues)
- ๐Ÿ’ก **Feature requests**: [Start a discussion](https://github.com/macOS-Script-Bash-health_check/discussions)
- ๐Ÿ“– **Questions**: Check existing issues or start a new discussion

---

**Made with โค๏ธ for macOS power users and system administrators**