# Install on Linux The most convenient way to install COSEDA (and its dependency CrystFEL) is to use the [Homebrew](https://docs.brew.sh/Homebrew-on-Linux) package manager. COSEDA is entirely written in Python, therefore it should run natively on Windows. However, since its most important dependency CrystFEL does not have a Windows version, there is no Windows version of COSEDA maintained. If your machine is running on Windows, it is highly recommended to use [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/). > **Note:** If you are only interested in the preprocessing functions, you should be able to use them natively in Windows as well, but taking the one-time little extra step during the installation will pay off later in terms of performance. ## Installing WSL (skip if on native Linux system or already using WSL2) [Here](https://learn.microsoft.com/en-us/windows/wsl/install) you can find a step by step guide to install Windows Subsystem for Linux (WSL). We recommend to use Ubuntu/Debian. Please make sure you are using **WSL2** as this version natively supports graphical user interfaces (WSLg on Windows 11). > **Note:** All the following steps need to be done in your Linux shell. If you see a prompt starting with `PS C:\` you are likely in a Windows shell! ## Installing Homebrew (skip if already using Homebrew) ### 1) Prerequisites ```bash sudo apt update sudo apt install -y build-essential procps curl file git ``` ### 2) Install Homebrew (Linuxbrew) ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` ### 3) Add Homebrew to your shell ```bash echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" ``` ### 4) Check ```bash brew --version brew doctor ``` Congrats, this was the hardest part. ## Installing COSEDA ### 1) Add the tap This tells Homebrew where it can find the source of COSEDA. ```bash brew tap kristallorakel/coseda https://gitlab.com/kristallorakel/homebrew-coseda.git ``` ### 2) Install ```bash brew install coseda ``` ### Optional: install the nightly build The nightly build contains beta changes from the development branch. It is useful for testing new features, but it may be less stable than the regular release. ```bash brew install coseda-nightly ``` The stable and nightly formulas both install the `coseda` command, so Homebrew will not install them side by side. To switch between them: ```bash brew uninstall coseda brew install coseda-nightly ``` or: ```bash brew uninstall coseda-nightly brew install coseda ``` ### 3) Run If the installation was successful, you can run COSEDA via a simple command. Running it for the first time might take a moment, please be patient. ```bash coseda ``` ### Updating We already told Homebrew where to find COSEDA, so if you want to upgrade to the latest version, you can simply do so by telling Homebrew to check if there is a newer version and upgrade, if one is available. ```bash brew update && brew upgrade coseda ``` ## Installing CrystFEL [CrystFEL](https://www.desy.de/~twhite/crystfel/index.html) is COSEDA's most important dependency. Similarly, you can install it using homebrew: CrystFEL's build requires the lexer generator `flex`. On some systems, the Homebrew-provided `flex` is not visible inside Homebrew's build environment, so we install `flex` (and `bison`) via `apt`. ```bash sudo apt-get update sudo apt-get install -y flex bison brew tap desy/crystfel https://gitlab.desy.de/thomas.white/homebrew-crystfel brew install crystfel ```