Late-Night Story: When ‘sudo apt install’ is a Luxury
It was 2 AM on a Tuesday, and I was struggling with a client’s Ubuntu 20.04 LTS server to fix an automation script urgently. The script required gh (GitHub CLI) version 2.40 or higher to run the new API. Unfortunately, the default OS repository only had the ancient version 2.4, which lacked many features.
Things got even more frustrating because my account didn’t have sudo privileges. Calling the infrastructure team for access in the middle of the night was hopeless. It felt like standing in front of a locked door while the house was on fire, and the key was in the pocket of someone fast asleep.
When I first started as a Sysadmin, I once spent an entire afternoon compiling from source only to fall into “dependency hell.” But this time, I used Homebrew (or Linuxbrew) to resolve everything neatly in 5 minutes.
Why Default Package Managers Can Be Difficult?
Linux users are used to apt, yum, or dnf. However, in real-world environments, they reveal two major weaknesses:
- Outdated Packages: Distros like Debian or CentOS prioritize stability, so packages are often 6 months to 2 years behind the original release.
- Permission Barriers: You can’t install
htoporfzfif you lacksudo. In large enterprises, the process to request root access can take days.
You could download the binary and copy it to /usr/local/bin. This works immediately but becomes a nightmare when updating. You’ll soon forget which version you installed and where you put it.
Homebrew – Not Just for macOS
People often assume Brew is a Mac-only “specialty.” In reality, it runs smoothly on Linux because it installs everything into the user’s home directory. Three major advantages include:
- Install packages freely without touching root permissions.
- Always stay updated with the latest (bleeding edge) versions as soon as they are released.
- Completely isolated from system libraries, so no risk of breaking the OS.
Practical Implementation Steps
1. Prepare the Environment
Brew doesn’t need root to install packages, but to install Brew itself, the server needs a few basic tools. If it’s a brand-new server, ask an admin to run this command once:
# For Ubuntu/Debian
sudo apt-get install build-essential procps curl file git
# For Fedora/CentOS/RHEL
sudo yum groupinstall 'Development Tools'
sudo yum install curl file git
2. Run the Installation Script
Don’t copy-paste blindly. Use the official command from Homebrew’s GitHub to ensure safety:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This process takes about 2-3 minutes. Brew will automatically install into /home/linuxbrew/.linuxbrew or ~/.linuxbrew depending on your user permissions.
3. Configure Environment Variables (Important Step)
The most common error is typing brew after installation and getting a command not found error. The shell needs to know the path to the Brew directory. Don’t close the terminal yet; look at the “Next steps” section and run commands similar to these:
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
Now, every time you log in, Brew will be ready automatically.
Getting the Job Done in a Flash
Back to that 2 AM shift—once I had Brew, it took me exactly 30 seconds to get the tool:
# Update package list
brew update
# Install the latest GitHub CLI version (e.g., v2.45.0)
brew install gh
# Verify
gh --version
Result: I had the latest gh version immediately, fixed the script, and went to bed at 2:15 AM instead of waiting for an admin’s response.
Useful “Pocket” Commands:
brew list: List installed tools.brew upgrade: Upgrade everything to the latest version with one command.brew doctor: Self-diagnose system errors (highly recommended if Brew feels slow).brew cleanup: Remove junk files and old versions to free up disk space.
Notes from Real-World Experience
While Brew is convenient, don’t turn it into a dumping ground. Here is some of my advice:
- Avoid installing system services: Don’t install Docker, Nginx, or MySQL via Brew if you want long-term stability. Use Docker containers or standard OS packages for these. Brew is strongest for CLI tools (jq, ripgrep, neovim…).
- Check for conflicts: If a tool exists in both
aptandbrew, typewhich <package_name>to see which version you are using. Usually, the Brew version takes priority. - Disk space: Brew keeps a cache of old downloads. If the server is low on space, run
brew cleanupregularly.
Conclusion
Homebrew on Linux is a true lifesaver when you are limited by permissions or need the latest tools to get work done. It helped me escape dependency hell to focus on what matters most: solving the problem. If you haven’t tried it yet, install it on your lab server today. Trust me, it will save you a lot of time in the long run.

