> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/leonardo02lobo/Memory-Monitor/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Memory Monitor on your Linux system

## System Requirements

Before installing Memory Monitor, ensure your system meets these requirements:

* **Operating System**: Linux (any distribution)
* **Python Version**: Python 3.x
* **Access**: Read permissions for `/proc` filesystem
* **Dependencies**: None (uses only Python standard library)

<Note>
  Memory Monitor is specifically designed for Linux systems as it reads from the `/proc` filesystem. It will not work on Windows or macOS.
</Note>

## Installation Steps

<Steps>
  <Step title="Verify Python Installation">
    First, check that you have Python 3.x installed on your system:

    ```bash theme={null}
    python3 --version
    ```

    You should see output like `Python 3.x.x`. If Python is not installed, install it using your distribution's package manager:

    ```bash theme={null}
    # Debian/Ubuntu
    sudo apt update
    sudo apt install python3

    # Fedora/RHEL
    sudo dnf install python3

    # Arch Linux
    sudo pacman -S python
    ```
  </Step>

  <Step title="Clone the Repository">
    Clone the Memory Monitor repository to your local machine:

    ```bash theme={null}
    git clone https://github.com/leonardo02lobo/Memory-Monitor.git
    cd Memory-Monitor
    ```

    Alternatively, if you received the source files directly, extract them to a directory:

    ```bash theme={null}
    mkdir memory-monitor
    cd memory-monitor
    # Copy main.py, memory_info.py, and process_analyzer.py here
    ```
  </Step>

  <Step title="Verify File Structure">
    Ensure all three required Python files are present in your directory:

    ```bash theme={null}
    ls -l
    ```

    You should see:

    * `main.py` - The entry point that runs the monitoring tool
    * `memory_info.py` - Contains the `InformationMemory()` function
    * `process_analyzer.py` - Contains the `ListDirectory()` function
  </Step>

  <Step title="Verify Installation">
    Test that Memory Monitor works by running it:

    ```bash theme={null}
    python3 main.py
    ```

    If successful, you'll see memory statistics and the process with highest memory usage. See the [Quickstart](/quickstart) guide for details on interpreting the output.
  </Step>
</Steps>

## Optional: Make It Executable

For convenience, you can make the script executable and add it to your PATH:

```bash theme={null}
# Make the script executable
chmod +x main.py

# Add shebang to main.py if not present
echo '#!/usr/bin/env python3' | cat - main.py > temp && mv temp main.py
chmod +x main.py

# Run directly
./main.py
```

## Permissions

Memory Monitor reads from the `/proc` filesystem, which typically requires:

* **System memory info** (`/proc/meminfo`) - Readable by all users
* **Process information** (`/proc/[pid]/status`) - Some processes may require root access

<Note>
  If you see permission errors for certain processes, this is normal. Memory Monitor will skip those processes and continue analyzing others. Run with `sudo` if you need complete access to all process information.
</Note>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Python command not found">
    Python 3 is not installed or not in your PATH. Install Python 3 using your distribution's package manager (see Step 1).
  </Accordion>

  <Accordion title="Module import errors">
    Ensure all three files (`main.py`, `memory_info.py`, `process_analyzer.py`) are in the same directory. Memory Monitor uses relative imports.
  </Accordion>

  <Accordion title="Permission denied errors">
    Some process directories in `/proc` require elevated privileges. This is expected behavior - the tool will skip those processes. Run with `sudo python3 main.py` if you need access to all processes.
  </Accordion>
</AccordionGroup>

## Next Steps

Now that Memory Monitor is installed, proceed to the [Quickstart](/quickstart) guide to learn how to use it.
