简体   繁体   中英

Why brew installation needs sudo access?

Why brew installation needs sudo access?

Is it even safe to install brew as sudo?

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

==> Checking for `sudo` access (which may request your password).
Sorry, user XXX may not run sudo on XXXXXX.
Need sudo access on macOS (e.g. the user XXX needs to be an Administrator)!

I am super confused here and wondering is it ok to install brew with sudo or not?

Also why is it ok to install brew as sudo?

Homebrew doesn't need sudo access to install formulas and casks with brew install but it needs sudo access to install itself.

If you look at the official installation script , you will find 24 call to the execute_sudo function. They are related to creating directories, changing ownerships, installing Command Line Tools,...

All this is done to allow you to use Homebrew without sudo, but sudo is needed once for the Homebrew installation. So if you trust Homebrew you can install it with sudo privileges, it's part of the normal workflow.

No sudo at all to install it.

The instructions for mac are here: It took a while to compile it and make it almost like a cheat-sheet that works across other issues, but give this a try. They should add this to official docs of homebrew.

[http://wwwhww.news/u/cwSNkeLNXf#Setting up brew on macOS under local account (no sudo)][1]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM