Homebrew on Shani OS — For macOS Switchers and Those Who Prefer It

If you are coming from macOS and brew install is muscle memory, you do not need to abandon it on Shani OS. Homebrew installs to /home/linuxbrew/.linuxbrew — completely outside the read-only OS root — and works exactly as it does on macOS.

That said, Shani OS also comes with Nix pre-installed, which solves the same problem in a different and, for many workflows, more powerful way. This guide covers setting up Homebrew, explains when to use it versus Nix, and shows how both coexist without conflict.

Full reference: docs.shani.dev — Homebrew.

---

Installing Homebrew

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

# Add to your PATH (Homebrew will show you the exact commands at the end of install)
# For Zsh — add to ~/.zshrc:
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# Reload shell
source ~/.zshrc

# Verify
brew --version

Homebrew installs to /home/linuxbrew/.linuxbrew on Linux, which is inside the @home subvolume. This means:

  • Homebrew packages survive every OS update and rollback untouched
  • Homebrew itself survives every OS update and rollback untouched
  • No root required for any Homebrew operation

---

Basic Usage

# Install a formula
brew install ripgrep
brew install node
brew install python
brew install git
brew install jq

# Install a cask (GUI apps — limited on Linux, most are macOS-only)
# brew install --cask firefox  # not available on Linux; use Flatpak instead

# Search for packages
brew search "some-tool"

# Get info about a package
brew info node

# Update Homebrew itself
brew update

# Upgrade all installed packages
brew upgrade

# Upgrade a specific package
brew upgrade node

# Uninstall a package
brew uninstall ripgrep

# List installed packages
brew list

# Check for issues
brew doctor

---

Homebrew vs the Full Ecosystem

Homebrew is a solid choice for macOS switchers who want continuity — it installs to /home/linuxbrew/.linuxbrew outside the read-only root and works identically to macOS. For new Shani OS users without a Homebrew habit, Nix is more powerful: it handles multiple versions without conflict and provides reproducible per-project environments via shell.nix. Both coexist fine — many macOS switchers run Homebrew initially and migrate specific workflows to Nix over time.

The Shani OS Software Ecosystem covers all ecosystems including Flatpak, Distrobox, Podman, and VMs.

Package Overlap with Nix

Many tools are available in both Homebrew and Nixpkgs. If you have installed the same tool in both, the one earlier in your $PATH takes precedence. This is usually fine, but check if you ever see unexpected behaviour:

# See which version of a tool you are using
which node
which python3
which git

To keep things clean, pick one tool manager for each package and stick with it.

---

Homebrew and the Immutable Root

Homebrew on macOS writes to /usr/local or /opt/homebrew. On Linux, it writes to /home/linuxbrew/.linuxbrew. This is intentional — Homebrew Linux adopted a home-directory prefix precisely because many Linux systems (including immutable ones) do not allow writes to /usr/local.

This means brew install works on Shani OS exactly as it does on macOS, with no workarounds or special configuration.

---

Keeping Homebrew Updated

# Update Homebrew's package database
brew update

# Upgrade all packages
brew upgrade

# See what is outdated
brew outdated

# Remove old versions of packages (saves disk space)
brew cleanup

# Remove all cached downloads
brew cleanup --prune=all

Homebrew does not have automatic updates by default. Consider adding a cron job or alias:

# Add to ~/.zshrc for a reminder
alias brewup='brew update && brew upgrade && brew cleanup'

---

Resources

---

Built in India 🇮🇳 · Immutable · Atomic · Zero Telemetry