Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save fardjad/2e38d4dbdd42b28ec8bbe0b725e67f37 to your computer and use it in GitHub Desktop.

Select an option

Save fardjad/2e38d4dbdd42b28ec8bbe0b725e67f37 to your computer and use it in GitHub Desktop.
[How to Install Homebrew on Debian-based Distros] Steps required to install homebrew on MX Linux (and other Debian-based distros) #linux #debian #mxlinux #homebrew

How to Install Homebrew on Debian-based Distros

Steps required to install Homebrew on MX Linux (and other Debian-based distros)

Steps

  1. Update apt cache and optionally do a full upgrade

     apt update
     apt full-upgrade # optional, reboot if needed
    
  2. Install build tools

     apt install build-essential procps curl file git
    
  3. Install homebrew:

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

     [ -d /home/linuxbrew/.linuxbrew ] && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
     
     # You most likely want to add the above line to your shell startup file as well.
    
  5. Make brew doctor happy

     brew doctor
     
     # Ignore the warning about config scripts
    
  6. Install gcc (as recommended by the installer script)

     brew install gcc
    
@andrewmkano
Copy link
Copy Markdown

Thank you!

@spartanbear
Copy link
Copy Markdown

Grazie!

@PaoloHi
Copy link
Copy Markdown

PaoloHi commented Feb 17, 2025

thanks

@NewScopeTech
Copy link
Copy Markdown

Thanks

@eabase
Copy link
Copy Markdown

eabase commented May 6, 2026

Unfortunately Homebrew is using a poor choice of install location that is very much against all Linux community standards. It creates a superficial user directory under /home/homebrew/.homebrew.

In all other linux packages known to man, that has never been done before, and should never be done again.
Instead homebrew should go into /opt/homebrew and nowhere else. If you know how to use linux file permissions, this can be easily done with:

sudo install -d -o $USER -g $USER -m 775 /opt/homebrew
chmod o+s homebrew
cd /opt/homebrew

# Getting last TAG from repo
LAST_HOMEBREW_RELEASE=$(git ls-remote --tags -b https://github.com/Homebrew/brew | tail -n 1 | grep -o -E 'refs/tags/[0-9\.]+' | sed 's/refs\/tags\///')
git clone --depth=1 --branch $LAST_HOMEBREW_RELEASE https://github.com/Homebrew/brew /opt/homebrew

# Check Version
./bin/brew --version
# Homebrew 5.1.9

git describe --tags --abbrev=0
# 5.1.9

After this, sudo should never be needed and file permissions will be propagated automatically to new installs and updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment