Skip to content

omkarlalla-code/mac-memory-toolkit

Repository files navigation

Mac Memory Toolkit

macOS License Shell Intel Apple Silicon

Professional memory management and system optimization toolkit for macOS

Squeeze every MB out of your Mac with intelligent memory management, cache cleanup, and performance monitoring tools.

FeaturesInstallationUsageFAQ


🎯 Perfect For

  • Low-RAM Macs (4-8GB) - Extend the life of older hardware
  • Developers - Optimize your system for resource-intensive IDEs and build tools
  • Power Users - Keep your Mac running smoothly under heavy workloads
  • MacBook Users - Reduce thermal throttling and improve battery life

✨ Features

🔍 Real-Time Monitoring

  • Memory usage breakdown (free, active, inactive, wired)
  • Top memory-consuming processes
  • CPU temperature tracking (with optional osx-cpu-temp)
  • Swap activity monitoring
  • System load averages

🧹 Intelligent Cleanup

  • Browser cache clearing (Chrome, Safari)
  • Development tool cache cleanup (npm, pip, etc.)
  • Automatic removal of stale cache files (7+ days old)
  • Typically frees 200-500MB per cleanup

Performance Optimization

  • Chrome tab process management (free memory without closing browser)
  • Development mode (maximize available RAM for coding)
  • Quick system maintenance and recovery
  • Optional UI animation disabling for snappier performance

🤖 Automation

  • Optional daily cleanup scheduling (runs at 3 AM)
  • LaunchAgent integration
  • One-command installation

🛠 What's Included

Command Description Typical Impact
memcheck Monitor memory, CPU, temperature View system health
memclean Clear browser & dev caches Free 200-500MB
chromekill Kill Chrome tabs (keeps browser open) Free ~50MB per tab
devmode Optimize for development work Free max available RAM
quickfix Complete system maintenance Fix sluggish performance
memstats Detailed system statistics Advanced monitoring

📦 Installation

Quick Install (Recommended)

# 1. Clone the repository
git clone https://github.com/omkarlalla-code/mac-memory-toolkit.git
cd mac-memory-toolkit

# 2. Run the installer
bash install.sh

# 3. Open a new terminal and start using commands!
memcheck

The installer will:

  • ✅ Install scripts to ~/.local/bin/
  • ✅ Add convenient aliases to your shell profile
  • ✅ Optionally set up daily automatic cleanup
  • ✅ Optionally apply system performance optimizations
  • ✅ Create backups of your configuration files

Manual Installation

Click to expand manual installation steps
# 1. Create directory
mkdir -p ~/.local/bin

# 2. Copy scripts
cp *.sh ~/.local/bin/

# 3. Make executable
chmod +x ~/.local/bin/*.sh

# 4. Add to your shell profile (~/.bash_profile or ~/.zshrc)
export PATH="$HOME/.local/bin:$PATH"
alias memcheck='~/.local/bin/memory-monitor.sh'
alias memclean='~/.local/bin/memory-cleanup.sh'
alias chromekill='~/.local/bin/kill-chrome-tabs.sh'
alias devmode='~/.local/bin/dev-mode.sh'
alias quickfix='~/.local/bin/quickfix.sh'

# 5. Reload your shell
source ~/.bash_profile  # or source ~/.zshrc

💻 Usage

Monitor System Memory

memcheck

Output example:

🔍 Top memory consumers:
%-20s %6.1f%% %s
Google Chrome      24.3% /Applications/Google Chrome.app
Code Helper        12.1% /Applications/Visual Studio Code.app

📊 Memory breakdown:
Pages free:         512.00 MB
Pages active:      2048.00 MB
Pages inactive:     768.00 MB
Pages wired:       1024.00 MB

💾 Disk usage:
Used: 45GB / 121GB (38%)

🔄 Swap activity:
vm.swapusage: total = 512.00M  used = 128.00M  free = 384.00M

🌡️  Temperature & CPU:
Load avg:  1.23, 1.45, 1.67
CPU temp: 62°C ✅ Cool

Clean Up Memory

memclean

Cleans:

  • Chrome & Safari caches
  • npm, pip, and other dev tool caches
  • Old cache files (7+ days)

Emergency Chrome Memory Recovery

chromekill

Kills all Chrome tab processes while keeping the browser window open. Great for quick memory recovery without losing your session.

Developer Mode

devmode

Optimizes your system for development:

  • Optionally kills Chrome if using >15% RAM
  • Runs full cache cleanup
  • Reports available memory
  • Provides optimization tips

Quick System Fix

quickfix

Comprehensive system maintenance:

  1. Clears all caches
  2. Checks swap usage
  3. Restarts Dock and Finder
  4. Flushes DNS cache
  5. Detects resource hogs
  6. Temperature check
  7. Provides actionable recommendations

🖥 Compatibility

Operating Systems

  • ✅ macOS 10.13 High Sierra and newer
  • ✅ macOS 10.15 Catalina (tested)
  • ✅ macOS 11 Big Sur
  • ✅ macOS 12 Monterey
  • ✅ macOS 13 Ventura
  • ✅ macOS 14 Sonoma
  • ✅ macOS 15 Sequoia

Hardware

  • ✅ Intel Macs (all models)
  • ✅ Apple Silicon (M1/M2/M3/M4)
  • ✅ MacBook Air, MacBook Pro, iMac, Mac Mini

Dependencies

  • Required: bash, standard Unix tools (pre-installed on macOS)
  • Optional: bc for calculations (usually pre-installed)
  • Optional: osx-cpu-temp for actual temperature readings
    brew install osx-cpu-temp

🎓 Best Practices

Daily Routine

# Morning: Check system health
memcheck

# Before intensive work: Free up memory
memclean

# When system feels slow: Quick maintenance
quickfix

# Chrome eating RAM: Kill tabs
chromekill

For 4GB RAM Systems

  • Keep Chrome tabs under 5-10
  • Close unused applications immediately
  • Restart daily
  • Enable daily auto-cleanup during installation
  • Consider disabling UI animations

For 8GB+ RAM Systems

  • Keep Chrome tabs under 15-20
  • Run cleanup weekly
  • Restart weekly
  • Use primarily for monitoring

🔧 Advanced: System Optimizations

The installer offers optional performance tweaks:

UI Performance Boosts

# Disable window animations (applied by installer)
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.finder DisableAllAnimations -bool true

To Revert Optimizations

defaults delete NSGlobalDomain NSAutomaticWindowAnimationsEnabled
defaults delete NSGlobalDomain NSWindowResizeTime
defaults delete com.apple.dock autohide-delay
defaults delete com.apple.dock autohide-time-modifier
defaults delete com.apple.finder DisableAllAnimations
killall Dock && killall Finder

🗑 Uninstallation

# Remove scripts
rm -rf ~/.local/bin/memory-*.sh
rm -rf ~/.local/bin/kill-chrome-tabs.sh
rm -rf ~/.local/bin/dev-mode.sh
rm -rf ~/.local/bin/quickfix.sh

# Remove scheduled cleanup (if enabled)
launchctl unload ~/Library/LaunchAgents/com.local.memory-cleanup.plist
rm ~/Library/LaunchAgents/com.local.memory-cleanup.plist

# Remove aliases from shell profile (manual edit required)
# Edit ~/.bash_profile or ~/.zshrc and remove the "Mac Memory Toolkit" section

# Restore from backup if needed
ls ~/.bash_profile.backup.*
# cp ~/.bash_profile.backup.TIMESTAMP ~/.bash_profile

❓ FAQ

Q: Will this work on macOS Ventura/Sonoma/Sequoia? A: Yes! Uses only standard Unix commands that are present in all macOS versions.

Q: Does it work on M1/M2/M3 Macs? A: Absolutely! Fully compatible with Apple Silicon.

Q: Is it safe? Will it delete my files? A: Yes, it's safe. Only clears caches and temporary files. Never touches user documents or system files.

Q: How much memory will I save? A: Typically 200-500MB from cache cleanup, 50MB+ per Chrome tab killed. Results vary based on usage.

Q: Do I need Homebrew? A: No, but installing osx-cpu-temp via Homebrew gives you actual temperature readings instead of estimates.

Q: Can I use this on multiple Macs? A: Yes! Clone or install on as many Macs as you want.

Q: Will it speed up my Mac? A: Yes, by freeing RAM and reducing memory pressure, which prevents slowdowns from swapping.

Q: Does it work with zsh (default shell on macOS Catalina+)? A: Yes! The installer detects your shell and updates the appropriate profile file.

🐛 Troubleshooting

Commands not found after installation

# Reload your shell configuration
source ~/.bash_profile  # or source ~/.zshrc

# Or simply open a new terminal window

Permission denied errors

chmod +x ~/.local/bin/*.sh

Temperature readings not working

# Install osx-cpu-temp for accurate readings
brew install osx-cpu-temp

# Alternative: Use powermetrics (requires sudo)
sudo powermetrics --samplers smc -i1 -n1

Different behavior on another Mac

  • Memory calculations scale to available RAM
  • Temperature readings vary by CPU model
  • Chrome process names may differ between versions
  • Some commands may need sudo on different configurations

📊 Performance Impact

Tested on: MacBook Air (2013), 4GB RAM, macOS Catalina 10.15

Scenario Before After Improvement
Available RAM (idle) 512MB 1024MB +100%
Chrome (10 tabs) 850MB 300MB (after chromekill) -65%
System cache 450MB 50MB (after cleanup) -89%
Boot time 45s 38s (with optimizations) -16%

🙏 Credits

Created to breathe new life into older Macs and help developers maximize their system resources.

Tested extensively on:

  • MacBook Air 6,2 (2013) - 4GB RAM - macOS Catalina 10.15

📄 License

MIT License - Free to use, modify, and distribute.

See LICENSE for full details.


Made with ❤️ to extend the life of aging Macs

If this toolkit helped your Mac run better, consider giving it a ⭐!

Report BugRequest Feature

About

memory management and system optimizer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages