DebianDebian Based

How To Install Homebrew on Debian 13

Install Homebrew on Debian 13

Homebrew has revolutionized package management across multiple operating systems. Originally designed for macOS, this powerful tool now brings the same flexibility and convenience to Linux distributions, including Debian 13. Installing Homebrew on Debian 13 opens up a world of possibilities for developers and system administrators who need access to cutting-edge software packages without waiting for official repository updates.

This comprehensive guide walks through every step of the Homebrew installation process on Debian 13. You’ll learn the prerequisites, execute the installation, configure your system properly, and troubleshoot common issues. Whether you’re a seasoned Linux user or transitioning from macOS, this tutorial provides everything needed to get Homebrew running smoothly on your Debian system.

What is Homebrew and Why Use It on Debian 13?

Understanding Homebrew for Linux

Homebrew bills itself as “the missing package manager,” and for good reason. This open-source software management system simplifies the installation of applications and utilities that might not be available through traditional package managers. Originally known as Linuxbrew when first ported to Linux, the project has since merged with the main Homebrew codebase, creating a unified experience across all platforms.

The beauty of Homebrew lies in its user-centric approach. Unlike system package managers that require root privileges and install software globally, Homebrew operates primarily in user space after initial setup. This design philosophy means you can manage packages without constantly invoking sudo commands, reducing security risks and giving you greater control over your development environment.

For Debian 13 users specifically, Homebrew offers several compelling advantages. First, it provides access to software packages not yet available in Debian’s stable repositories. Second, it delivers more current versions of development tools without upgrading your entire system. Third, Homebrew installations remain isolated from system packages, preventing dependency conflicts that can plague mixed package management scenarios.

How Homebrew Differs from APT

Debian’s Advanced Package Tool (APT) and Homebrew serve similar purposes but operate quite differently. APT installs packages system-wide in directories like /usr/bin and /usr/lib, requiring administrative privileges. Homebrew, conversely, installs everything under /home/linuxbrew/.linuxbrew, keeping applications separate from system directories.

Homebrew also utilizes “bottles”—precompiled binary packages that install quickly without compilation. When bottles aren’t available for your system, Homebrew compiles from source automatically. This flexibility ensures you can install virtually any package, regardless of whether pre-built versions exist.

The two package managers complement rather than compete with each other. Use APT for core system utilities and stability-critical software. Reserve Homebrew for development tools, bleeding-edge applications, and packages you want to update independently of system releases.

System Requirements and Prerequisites

Hardware and Software Requirements

Before installing Homebrew on Debian 13, verify your system meets the necessary requirements. Debian 13 (codenamed “Trixie”) fully supports Homebrew without compatibility issues. Your system should have at least 5GB of free disk space to accommodate Homebrew itself and several packages comfortably.

A stable internet connection is essential, as the installation script downloads files from GitHub and other repositories. Homebrew supports 64-bit x86 architectures natively, with ARM support available though sometimes requiring compilation from source rather than using pre-built bottles.

Essential Dependencies

Homebrew requires several build tools and utilities to function correctly. The most critical packages include:

  • build-essential: Provides GCC compiler, make, and other compilation tools
  • procps: Supplies process monitoring utilities Homebrew uses internally
  • curl: Enables downloading files from URLs during installation and package fetches
  • file: Determines file types, which Homebrew uses for compatibility checks
  • git: Version control system required for updating Homebrew and fetching formulae

Each dependency plays a specific role. Without build-essential, Homebrew cannot compile packages from source. Missing curl prevents the installation script from running at all. Git enables Homebrew’s update mechanism and formula management system.

Pre-Installation Steps

Update Your Debian 13 System

Start with a fresh system update. Open your terminal and execute:

sudo apt update

This command refreshes your package index, ensuring you’re working with the latest repository information. For systems that haven’t been updated recently, consider running a full upgrade:

sudo apt full-upgrade

The full upgrade installs all available updates and handles dependency changes intelligently. If kernel updates install during this process, reboot your system before proceeding with Homebrew installation.

Install Required Build Tools and Dependencies

Install all necessary dependencies with a single command:

sudo apt-get install build-essential procps curl file git

This command installs everything Homebrew needs to operate. The installation typically completes within a few minutes, depending on your internet speed and whether some packages are already present.

Verify the installations succeeded by checking each tool:

which gcc curl git

Each command should return a path like /usr/bin/gcc, confirming successful installation. If any tool is missing, install it individually using sudo apt-get install [package-name].

Prepare Your User Environment

Determine which shell you’re using:

echo $SHELL

Most Debian installations use bash by default, though some users prefer zsh or other shells. Note your shell type, as you’ll need this information when configuring your environment later.

Consider backing up your shell configuration file before making changes:

cp ~/.bashrc ~/.bashrc.backup

This precaution lets you restore your original configuration if something goes wrong.

Installing Homebrew on Debian 13

Step 1: Download the Installation Script

The official Homebrew installation uses a script hosted on GitHub. Execute this command to download and run it:

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

Let’s break down what this command does:

  • /bin/bash -c tells the system to execute what follows using bash
  • curl -fsSL downloads the script with specific flags:
    • -f fails silently on server errors
    • -s runs in silent mode without progress bars
    • -S shows errors even in silent mode
    • -L follows redirects if the URL has moved
  • The URL points to the official Homebrew installation script repository

Security-conscious users can download the script first, review its contents, and then execute it manually. This extra step ensures you understand exactly what the installation will do.

Step 2: Run the Installation Script

When you execute the installation command, several things happen automatically. The script first checks your system for required dependencies, then prompts for your password to create necessary directories with sudo privileges.

You’ll see output indicating the installation progress. The script creates the /home/linuxbrew/.linuxbrew directory structure and clones the Homebrew repository from GitHub. This process typically takes 5-10 minutes on a decent internet connection.

During installation, the script displays important information about PATH configuration. Pay attention to these messages—they contain specific commands you’ll need to run next.

The installer automatically handles permissions, ensuring your user account owns the Homebrew directory while maintaining appropriate security settings.

Step 3: Configure Your Shell Environment

Homebrew won’t work immediately after installation because your shell doesn’t know where to find it. You must add Homebrew’s location to your PATH environment variable.

For bash users, add Homebrew to your shell configuration:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc

This command appends the necessary configuration to your .bashrc file, which bash reads every time you open a new terminal.

For zsh users, target the .zshrc file instead:

echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.zshrc

The brew shellenv command generates several environment variable exports that configure Homebrew’s PATH, MANPATH, and INFOPATH correctly.

A more robust approach uses a conditional check:

test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

This version first verifies the Homebrew directory exists before attempting to initialize it, preventing errors if Homebrew gets uninstalled or moved.

Step 4: Apply the Configuration Changes

Your shell won’t recognize the new PATH until you reload the configuration. Do this by sourcing your updated configuration file:

source ~/.bashrc

Alternatively, close your current terminal and open a fresh one. The new session automatically reads the updated configuration.

Verify the PATH includes Homebrew by running:

echo $PATH

You should see /home/linuxbrew/.linuxbrew/bin listed among the directories. This confirms your shell can now locate Homebrew commands.

Verifying Your Homebrew Installation

Check Homebrew Version

Confirm Homebrew installed correctly by checking its version:

brew --version

This command should display output like “Homebrew 4.x.x” along with the Git revision. If you see this output, Homebrew is accessible and functioning.

Run Homebrew Doctor

Homebrew includes a diagnostic tool that checks for common configuration issues:

brew doctor

This comprehensive health check examines your installation for potential problems. In an ideal scenario, you’ll see:

Your system is ready to brew.

Don’t panic if you see warnings. Many warnings are informational rather than critical. Common harmless warnings include messages about config scripts in your home directory that won’t affect Homebrew’s operation.

If brew doctor reports actual problems—like missing dependencies or incorrect permissions—address them before installing packages. The diagnostic output usually includes suggestions for fixing detected issues.

Install GCC (Recommended Post-Installation Step)

Homebrew recommends installing GCC as your first package:

brew install gcc

While Debian provides GCC through APT, Homebrew’s version enables better compatibility when compiling packages from source. This installation may take significant time, as GCC is a large, complex package. Homebrew will likely compile it from source unless a bottle exists for your specific Debian version.

Installing Your First Package with Homebrew

Test your Homebrew installation by installing a simple utility. The tree command provides a good example:

brew install tree

Watch the installation process unfold. Homebrew first searches for a pre-compiled bottle matching your system. If found, it downloads and extracts the binary rapidly. Without a bottle, Homebrew downloads the source code and compiles it locally.

Homebrew installs packages to /home/linuxbrew/.linuxbrew/Cellar/[package-name] and creates symbolic links in /home/linuxbrew/.linuxbrew/bin for executables. This structure allows multiple versions of the same package to coexist.

After installation completes, verify the package works:

tree --version

The command should display version information, confirming successful installation and proper PATH configuration.

Common Homebrew Commands for Debian 13

Mastering basic Homebrew commands streamlines your package management workflow.

Search for packages:

brew search [package]

Install packages:

brew install [package]

Remove packages:

brew uninstall [package]

Update Homebrew itself:

brew update

Upgrade installed packages:

brew upgrade

List installed packages:

brew list

Get package information:

brew info [package]

Remove old versions:

brew cleanup

Check for outdated packages periodically:

brew outdated

This command lists packages with available updates, helping you keep your development tools current.

Troubleshooting Common Installation Issues

Permission Errors

If you encounter permission errors, verify directory ownership:

ls -la /home/linuxbrew/

The .linuxbrew directory should be owned by your user account, not root. Fix ownership issues with:

sudo chown -R $(whoami) /home/linuxbrew/.linuxbrew

Remember that Homebrew itself shouldn’t require sudo after installation. If you’re constantly using sudo with brew commands, something is misconfigured.

PATH Not Recognized

When the system reports “brew: command not found” despite successful installation, your PATH configuration failed. Double-check your shell configuration file for typos:

cat ~/.bashrc | grep brew

Verify the exact path matches /home/linuxbrew/.linuxbrew/bin/brew. Even small typos prevent proper initialization.

Users of alternative shells like fish or tcsh need different configuration approaches. Consult Homebrew’s documentation for shell-specific instructions.

Installation Script Fails

Network problems can interrupt the installation script. Ensure your internet connection works and you can access GitHub:

ping github.com

If curl or git aren’t found during installation, the dependency installation step failed. Return to the pre-installation steps and verify all required packages installed correctly.

Insufficient disk space causes cryptic errors. Check available space:

df -h ~

Ensure you have at least 5GB free in your home directory partition.

Homebrew Commands Not Found After Installation

When Homebrew installed successfully but commands don’t work in new terminal sessions, the shell configuration file wasn’t updated correctly or you’re using a non-standard shell.

Manually add Homebrew to your PATH by editing your shell configuration file directly:

nano ~/.bashrc

Add this line at the end:

eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Save the file and reload your configuration.

Performance and Bottles Issues

Installing Homebrew outside the default /home/linuxbrew/.linuxbrew prefix creates problems. Non-standard locations prevent Homebrew from using bottles, forcing source compilation for every package. This dramatically increases installation times and CPU usage.

If packages compile from source unexpectedly, verify your installation location matches the standard path. Older Debian systems may experience slower performance due to dated hardware or dependencies.

Best Practices for Using Homebrew on Debian 13

When to Use Homebrew vs APT

Strategic use of both package managers maximizes their strengths. Install system-critical software, libraries, and services through APT. This includes:

  • System utilities and core GNU tools
  • Services like Apache, PostgreSQL, or Redis
  • Libraries that multiple system applications depend on
  • Security-critical software requiring quick official patches

Use Homebrew for:

  • Development tools and programming languages
  • Command-line utilities you want to update independently
  • Software not available in Debian repositories
  • Applications where you need the absolute latest versions

Avoid installing the same package through both managers. This creates conflicts and wastes disk space.

Maintenance and Updates

Establish a regular maintenance schedule. Update Homebrew weekly:

brew update

This updates Homebrew itself and refreshes the formula database. Subsequently upgrade your packages:

brew upgrade

Run brew doctor monthly to catch configuration drift or emerging issues:

brew doctor

Homebrew caches old package versions and installation files. Clean up periodically:

brew cleanup -s

The -s flag also removes downloads from the cache, freeing significant disk space.

Congratulations! You have successfully installed Homebrew. Thanks for using this tutorial for installing the latest version of Homebrew on Debian 13 “Trixie” system. For additional help or useful information, we recommend you check the official Homebrew website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button