---

## 1. Install Miniforge

Miniforge is a lightweight installer for Conda that defaults to the **conda-forge** channel. This is essential because the ROOT community maintains the most up-to-date packages there.

### For Linux/macOS

1. Download the installer script from the [Miniforge GitHub](https://github.com/conda-forge/miniforge):
```bash
curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"

```


2. Run the installer:
```bash
bash Miniforge3-$(uname)-$(uname -m).sh

```


3. Follow the prompts (press `Enter`, type `yes` to license terms, and `yes` to initialize Miniforge).
4. **Restart your terminal** to activate the base environment.

---

## 2. Create a Dedicated Environment

Never install heavy packages like ROOT into your `base` environment. It’s better to keep things isolated.

```bash
# Create an environment named 'physics' with Python 3.10
conda create -n physics python=3.10

```

> [!TIP]
> While ROOT supports newer Python versions, **3.9 or 3.10** is often the "sweet spot" for stability with older C++ bindings.

---

## 3. Install CERN ROOT

Now, activate your environment and pull ROOT from the `conda-forge` channel.

```bash
# Activate the environment
conda activate physics

# Install ROOT
conda install -c conda-forge root

```

### Why use `conda-forge`?

ROOT has massive dependency chains (GSL, FFTW, X11 libraries, etc.). The Conda package manages these binaries for you, saving you from having to compile from source, which can take hours.

---

## 4. Verify the Installation

Once the installation finishes, you can verify it by launching the ROOT interactive shell or checking the Python bindings (PyROOT).

### Check the C++ Interpreter

Type `root` in your terminal:

```bash
root
# You should see the splash screen and the [0] prompt.
# Type .q to exit.

```

### Check PyROOT

Ensure Python can see the ROOT modules:

```python
python -c "import ROOT; print(ROOT.gROOT.GetVersion())"

```

---

## 5. Summary of Workflow

| Step | Command |
| --- | --- |
| **Activate Env** | `conda activate physics` |
| **Launch ROOT** | `root` |
| **Launch Python** | `python` (then `import ROOT`) |
| **Deactivate** | `conda deactivate` |

---

### Troubleshooting Tips

* **Graphics Issues:** If you are on **macOS**, ensure you have [XQuartz](https://www.xquartz.org/) installed if you plan on using TBrowser or graphical windows.
* **Conflicts:** If you run into "UnsatisfiableError," try creating a fresh environment. Adding packages one-by-one to an old environment often leads to dependency hell.
* **Pathing:** On Linux, if the GUI doesn't pop up, ensure your `DISPLAY` variable is set correctly (especially when using WSL2 or SSH).

```

```
