PyRadio pipx installation on MacOS

# PyRadio macOS installation

## Table of Contents Top

- Preface
- Preparation
  - Homebrew installation
  - Python Installation
  - Media player installation
  - Get the installation script
- PyRadio installation
  - Dependencies installation
  - Performing the installation

[ Return to PyRadio Build Instructions ]

## Preface Top

PyRadio on macOS can only be installed on Python 3 through pipx.

Furtermore, the pipx installation will be a fully isolated one, which means that all dependencies will be installed along with PyRadio in a virtual environment.

That is a one-way street to follow since the combination of macOS versions, python installation methods and player installation methods is too complex to provide a complete installation guide for PyRadio.

pipx provides a standardization of the whole procedure which leads to an acceptable (enjoyable even) user experience.

## Preparation Top

These are the steps required before actually installing PyRadio.

Note: The following installation instructions were performed on a freshly installed Ventura (macOS 13) system. Things may be a bit different for older macOs versions, but it will be the same for Sonoma (macOS 14).

### Homebrew installation

This is the method Homebrew recommends, so we just go with it.

Open a terminal and execute:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

### Python Installation

Your system comes with a pre-installed version of Python, but it would be better to install the one provided by Homebrew.

    brew install python3

This will also install “Apple’s Command Line Developer Tools” (if they are not already installed).

Then, adjust your PATH, so that the newly installed Python will be the default one.

    cat << END >> ~/.zshrc
    export PATH=/usr/local/bin:"$PATH"
    END
    source ~/.zshrc

### Media player installation

The next step is to install a supported media player (MPV, MPLayer or VLC). You are free to install any one of them or even more than one. The steps to follow from now on depends entirely on you, meaning depends entirely on the media player(s) you want to install and use with PyRadio.

1. VLC

VLC provides a macOS package, so you can just go get it from its site. This is the cleaner way and I would recommend it.

If this is the player you prefer, you will have to take one more step before it can be used with PyRadio.

Open a terminal and type:

    ln -s /Applications/VLC.app/Contents/MacOS/VLC ~/.local/bin/cvlc

2. MPV or MPlayer

MPV and MPlayer can be installed using Homebrew.

a) MPV

    brew install mpv

b) MPlayer

    brew install mplayer

### Get the installation script

Open a terminal and execute:

    cd
    curl -L \
        https://raw.githubusercontent.com/coderholic/pyradio/master/pyradio/install.py \
        -o install.py

## PyRadio installation Top

Your system is ready now for PyRadio to be installed.

### Dependencies installation

Open a terminal and type:

    python3 -m pip install requests rich pipx --break-system-packages

Finally, type:

    python3 -m pipx ensurepath
    source ~/.zshrc

### Performing the installation

Yo may be asked to provide your password during the installation; PyRadio will be installed as a terminal system wide Application.

Execute the following command:

    python3 install.py

Enjoy!