Skip to content

Samsuesca/ramctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ramctl

CLI tool for RAM management on macOS (Apple Silicon)

macOS Rust License

ramctl is a lightweight command-line interface for monitoring and managing RAM on macOS systems with Apple Silicon. It provides real-time memory statistics, process monitoring, and memory cleanup utilities.


Features

  • Memory Status: Display current RAM usage, swap, and memory pressure
  • Process Monitoring: List top processes by memory consumption
  • Real-time Monitor: Continuous monitoring with customizable refresh intervals
  • Memory Cleanup: Purge disk cache to reclaim memory (requires sudo)
  • Process Management: Terminate processes by PID to free memory
  • Color-coded Output: Visual indicators for memory pressure levels

Installation

From Source

# Clone the repository
git clone https://github.com/Samsuesca/ram_manager_cli.git
cd ram_manager_cli

# Build release binary
cargo build --release

# Install to PATH (optional)
cargo install --path .

Requirements

  • macOS with Apple Silicon (M1/M2/M3)
  • Rust 1.70 or higher

Usage

Show Memory Status

ramctl status

Displays:

  • Total, used, available, and free memory
  • Swap usage
  • Memory pressure (normal/warning/critical)

List Top Processes

# Show top 15 processes (default)
ramctl top

# Show custom number of processes
ramctl top --count 20

Real-time Monitoring

# Monitor every 2 seconds (default)
ramctl monitor

# Custom interval and process count
ramctl monitor --interval 5 --count 15

Press Ctrl+C to stop monitoring.

Clean Memory

# Purge disk cache (requires sudo)
sudo ramctl clean

⚠️ This command requires administrator privileges.

Kill Process

# Terminate process by PID
ramctl kill <PID>

Command Reference

Command Description Options
status Show current memory status None
top List top processes by RAM usage -c, --count <N>
monitor Real-time memory monitoring -i, --interval <seconds>
-c, --count <N>
clean Purge disk cache (sudo required) None
kill Terminate process by PID <PID>

Example Output

┌─────────────────────────────────────────────────────────┐
│                    MEMORY STATUS                        │
├─────────────────────────────────────────────────────────┤
│ Total:       16.00 GB                                   │
│ Used:        12.34 GB (77.1%)                          │
│ Available:   3.66 GB                                    │
│ Free:        1.45 GB                                    │
│ Swap Used:   512.00 MB                                  │
│ Pressure:    ⚠️  Warning                                │
└─────────────────────────────────────────────────────────┘

┌─────┬─────────────────────┬─────────┬──────────┐
│ PID │ Name                │ Memory  │ CPU (%)  │
├─────┼─────────────────────┼─────────┼──────────┤
│ 234 │ Google Chrome       │ 2.1 GB  │ 45.2     │
│ 567 │ Visual Studio Code  │ 1.8 GB  │ 12.3     │
│ 890 │ Docker Desktop      │ 1.2 GB  │ 8.5      │
└─────┴─────────────────────┴─────────┴──────────┘

Technical Stack

  • Language: Rust 2021 edition
  • Dependencies:
    • clap - Command-line argument parsing
    • sysinfo - System metrics collection
    • colored - Terminal color output
    • tabled - ASCII table formatting
    • bytesize - Human-readable byte sizes
    • ctrlc - Signal handling

Architecture

src/
├── main.rs       # CLI entry point and command routing
├── memory.rs     # Memory snapshot and pressure monitoring
├── process.rs    # Process enumeration and filtering
├── cleaner.rs    # Memory purge and process termination
└── display.rs    # Formatted output rendering

Platform Support

Platform Support
macOS (Apple Silicon) ✅ Full support
macOS (Intel) ⚠️ Untested
Linux ❌ Not supported
Windows ❌ Not supported

License

MIT License - see LICENSE file for details


Author

Angel Samuel Suesca Ríos suescapsam@gmail.com


Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Roadmap

  • Support for Intel-based Macs
  • Linux compatibility
  • Memory leak detection
  • Historical memory usage graphs
  • Configuration file support
  • Notification system for high memory usage

Acknowledgments

Built with Rust for the macOS ecosystem.

About

CLI tool for RAM management on macOS (Apple Silicon)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors