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
- Host: GitHub
- URL: https://github.com/wsmr/macos-script-bash-health_check
- Owner: wsmr
- License: mit
- Created: 2025-08-24T10:53:25.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-08-24T11:31:23.000Z (10 months ago)
- Last Synced: 2025-09-04T16:06:55.986Z (10 months ago)
- Topics: actionable-insights, bash, cpu-monitoring, diagnostics, health-check, load-analysis, macos, performance, shell-script, spotlight, system-administration, system-monitoring
- Language: Shell
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ฅ๏ธ macOS Health Check
[](https://opensource.org/licenses/MIT)
[](https://www.apple.com/macos/)
[](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**