Skip to content

Installer leaves behind a root-owned ~/Library/ #1024

@gurjeet

Description

@gurjeet
  • your problem was from running the official install or uninstall script?
  • you carefully read the output and it was not a git fetch or other connection issue to GitHub (that Homebrew has no control over)?
  • after installation: ran brew config and brew doctor and included their output with your issue? If you couldn't install: provided your OS version with the output of your issue?

What you were trying to do (and why)

On a macos guest/VM, I was trying to install a package that in turn depends on the ca-certificates package. I was trying to set up a reproducible development environment in a macos guest/VM.

What happened (include command output)

The brew install ca-certificates command exited with exit code 1. The root cause seems to be the fact that the Homebrew installer creates ~/Library/Cache/ directory with root as the owner, and then leaves it behind without fixing the permissions. So when the ca-certificates package's post-installation step tries to write to that directory, it fails to do so, since it's running as non-root user.

Command output
$ NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
...
==> Installation successful!
...
$ ls -ld ~/Library/{,Caches/{,Homebrew}}
drwxr-xr-x   3 root     staff   96 Aug 30 02:48 /Users/vagrant/Library/
drwxr-xr-x   3 root     staff   96 Aug 30 02:48 /Users/vagrant/Library/Caches/
drwxrwxr-x  11 vagrant  staff  352 Aug 30 02:48 /Users/vagrant/Library/Caches/Homebrew

$ eval "$(/opt/homebrew/bin/brew shellenv)"
$ brew install ca-certificates
...
==> Pouring ca-certificates--2025-08-12.all.bottle.2.tar.gz
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall ca-certificates
...

$ brew config
HOMEBREW_VERSION: 4.6.7
ORIGIN: https://github.com/Homebrew/brew
HEAD: 02947ea4edbdef5fcce9ee57fa289547f4d096c9
Last commit: 5 days ago
Branch: stable
Core tap JSON: 30 Aug 02:48 UTC
Core cask tap JSON: 30 Aug 02:48 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 2
Homebrew Ruby: 3.4.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/bin/ruby
CPU: dual-core 64-bit dunno
Clang: 17.0.0 build 1700
Git: 2.39.5 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.6-arm64
CLT: 16.4.0.0.1.1747106510
Xcode: N/A
Rosetta 2: false

$ brew doctor
Your system is ready to brew.

What you expected to happen

I expcted brew install to finish successfully.

Step-by-step reproduction instructions (by running brew commands)

NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
brew install ca-certificates

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions