0

As recommended, I created an admin user and a regular user which I use for regular usage. for some reason I keep getting asked for my sudo admin password (when installing apps, updating apps, etc) - I was wondering if this is proper practice.

and to my main problem - brew isn't allowing me to update (brew upgrade) nor install whatever it suggests to install: brew install --cask adoptopenjdk

How can I get permissions for brew? (I tried Most of the suggested solutions)

  • I tried using the regular user password and it just says that im not a sudoer.
  • I tried using my other admin user password and it didn't work.
  • I tried entering the other admin user via terminal using su adminuser+entering the admin password, then running sudo chown -R myregularuser $(brew --prefix)/*

this is my output.

myregularuser@my-MacBook-Pro ~ % brew upgrade
==> Casks with 'auto_updates' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 1 outdated package:
dbeaver-community 7.3.4 -> 7.3.5
==> Upgrading dbeaver-community
==> Caveats
dbeaver-community requires Java 8+. You can install the latest version with:
  brew install --cask adoptopenjdk

==> Downloading https://dbeaver.io/files/7.3.5/dbeaver-ce-7.3.5-macos.dmg
Already downloaded: /Users/myregularuser/Library/Caches/Homebrew/downloads/b40befbe84ad7d63eb719fde242f0c4f7fb1a8d019f1b546db8595f6b1901ff1--dbeaver-ce-7.3.5-macos.dmg
==> Backing App 'DBeaver.app' up to '/usr/local/Caskroom/dbeaver-community/7.3.4/DBeaver.app'
Password:

myregularuser@my-MacBook-Pro ~ % sudo chown -R $(whoami) $(brew --prefix)/*
Password:
myregularuser is not in the sudoers file.  This incident will be reported.

idk, maybe it's considered bad practice to use the regular user with brew, anyway, please help me to figure this out.

Edit:

I tried:

sudo chown -R myregularuser:admin /usr/local/Homebrew /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/man/man8 /usr/local/var/homebrew/locks

sudo chown -R myregularuser /usr/local/Homebrew /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/man/man8 /usr/local/var/homebrew/locks

both didn't work:

myregularuser@my-MacBook-Pro ~ % brew upgrade
==> Casks with 'auto_updates' or 'version :latest' will not be upgraded; pass `--greedy` to upgrade them.
==> Upgrading 1 outdated package:
dbeaver-community 7.3.4 -> 7.3.5
==> Upgrading dbeaver-community
==> Caveats
dbeaver-community requires Java 8+. You can install the latest version with:
  brew install --cask adoptopenjdk

==> Downloading https://dbeaver.io/files/7.3.5/dbeaver-ce-7.3.5-macos.dmg
Already downloaded: /Users/myregularuser/Library/Caches/Homebrew/downloads/b40befbe84ad7d63eb719fde242f0c4f7fb1a8d019f1b546db8595f6b1901ff1--dbeaver-ce-7.3.5-macos.dmg
==> Backing App 'DBeaver.app' up to '/usr/local/Caskroom/dbeaver-community/7.3.4/DBeaver.app'
Password:
Sorry, try again.
Password:
myregularuser is not in the sudoers file.  This incident will be reported.
==> Purging files for version 7.3.5 of Cask dbeaver-community
Error: dbeaver-community: Failure while executing; `/usr/bin/sudo -E -- /bin/cp -pR /Applications/DBeaver.app /usr/local/Caskroom/dbeaver-community/7.3.4/DBeaver.app` exited with 1. Here's the output:
myregularuser is not in the sudoers file.  This incident will be reported.

the doctor says:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/regularuser/.pyenv/shims/icu-config
  /Users/regularuser/.pyenv/shims/krb5-config
  /Users/regularuser/.pyenv/shims/libpng16-config
  /Users/regularuser/.pyenv/shims/python3.9-config
  /Users/regularuser/.pyenv/shims/python-config
  /Users/regularuser/.pyenv/shims/python3-config
  /Users/regularuser/.pyenv/shims/ncursesw6-config
  /Users/regularuser/.pyenv/shims/pcre-config
  /Users/regularuser/.pyenv/shims/python3.8-config

app permisions (notice dbeaver group)

regularuser@my-MacBook-Pro ~ % ls -la /Applications
total 0
drwxrwxr-x  49 root    admin  1568 Feb 20 21:47 .
drwxr-xr-x  20 root    wheel   640 Jan  1  2020 ..
-rw-r--r--   1 root    wheel     0 Jan  1  2020 .localized
drwxr-xr-x@  3 root    wheel    96 Jan  2 23:14 AdBlock.app
lrwxr-xr-x   1 regularuser  admin    70 Jan  3 16:01 Anaconda-Navigator.app -> /Users/regularuser/.pyenv/versions/anaconda3-2020.07/Anaconda-Navigator.app
drwxr-xr-x@  3 regularuser  staff    96 Dec 15 15:11 Bartender 4.app
drwxr-xr-x@  3 root    wheel    96 Jan 10 16:35 Battery Health 2.app
drwxr-xr-x@  3 root    wheel    96 Jan 30 17:32 BitdefenderVirusScanner.app
drwxr-xr-x@  3 root    wheel    96 Jan 23 06:27 Cinebench.app
drwxr-xr-x   3 root    wheel    96 Jan  4 23:12 Cubase 10.app
drwxr-xr-x@  3 regularuser  staff    96 Feb 15 19:58 DBeaver.app
drwxr-xr-x@  3 regularuser  admin    96 Dec 21 12:58 Docker.app
drwxr-xr-x   3 regularuser  admin    96 Feb 19 21:13 Dropbox.app
drwxr-xr-x   3 regularuser  admin    96 Jan  3 00:20 Fork.app
drwxr-xr-x@  3 regularuser  staff    96 Dec 19 17:07 GIMP-2.10.app
drwxr-xr-x@  3 root    wheel    96 Jan 23 06:45 GPU Benchmark.app
drwxrwxr-x   3 regularuser  admin    96 Feb 13 05:43 Google Chrome.app
drwxr-xr-x@  3 root    wheel    96 Jan 26 21:34 Grammarly for Safari.app
lrwxr-xr-x   1 root    admin    43 Jan  4 21:56 HALion Library Manager.app -> /Applications/Steinberg Library Manager.app
drwxr-xr-x@  3 root    wheel    96 Jan 27 17:22 Instastats.app
drwxr-xr-x   3 root    wheel    96 Feb 19 20:53 IriunWebcam.app
drwxr-xr-x@  3 root    wheel    96 Jan  2 23:11 LastPass.app
drwxr-xr-x   3 regularuser  admin    96 Jan  4 21:56 License Control Center.app
drwxrwxr-x@  3 root    wheel    96 Feb 16 20:57 Microsoft Excel.app
drwxrwxr-x@  3 root    wheel    96 Feb 16 20:55 Microsoft PowerPoint.app
drwxrwxr-x@  3 root    wheel    96 Feb 16 20:56 Microsoft Word.app
drwxr-xr-x@  3 regularuser  admin    96 Jan  9 02:07 OBS.app
drwxr-xr-x@  3 root    wheel    96 Feb 16 20:49 OneDrive.app
drwxr-xr-x@  3 root    wheel    96 Jan 30 18:26 Parcel.app
drwxr-xr-x   3 root    wheel    96 Feb  9 08:54 Postman.app
drwxr-xr-x@  3 root    wheel    96 Jan 21 16:10 Raindrop.io for Safari.app
drwxr-xr-x@  3 regularuser  admin    96 Jan  6 11:38 Razer macOS.app
drwxr-xr-x@  3 root    wheel    96 Jan  1  2020 Safari.app
drwxr-xr-x   3 regularuser  staff    96 Dec  9 01:11 Spotify.app
drwxr-xr-x@  3 regularuser  admin    96 Apr  7  2020 Steam.app
drwxr-xr-x   4 root    admin   128 Jan  4 21:55 Steinberg Download Assistant
drwxr-xr-x   3 root    wheel    96 Jan  4 21:56 Steinberg Library Manager.app
drwxr-xr-x@  3 regularuser  admin    96 Oct  1  2019 Sublime Text.app
drwxr-xr-x@  3 regularuser  admin    96 Dec 21 23:26 Turbo Boost Switcher.app
drwxr-xr-x   3 root    wheel    96 Jan  1  2020 Utilities
drwxr-xr-x   3 root    wheel    96 Feb  6 09:45 Visual Studio Code.app
drwxr-xr-x@  3 root    wheel    96 Feb 11 13:43 WhatsApp.app
drwxr-xr-x@  3 root    wheel    96 Feb  5 20:19 Xcode.app
drwxr-xr-x@  3 regularuser  staff    96 Dec 16 11:41 gfxCardStatus.app
drwxr-xr-x   3 regularuser  staff    96 Feb 12 21:38 iTerm.app
drwxrwxrwx   3 root    admin    96 Jan 14 18:03 lghub.app
drwxr-xr-x@  3 regularuser  staff    96 Jan 19 02:38 qBittorrent.app
drwxr-xr-x@  5 regularuser  admin   160 Nov  7 01:11 tbswitcher_resources
drwxr-xr-x   3 regularuser  wheel    96 Feb 11 14:45 zoom.us.app

a few new things i discovered:

I have been installing some apps on brew and everything works - BUT - it seems like some apps that use cask installations require sudo permissions (by the app, i think... doesn't have anything to do with brew itself) - I tried using --app-dir= (https://github.com/Homebrew/homebrew-cask/blob/master/USAGE.md#options) on some, some worked and some didn't (wireshark didn't work but dbeaver worked) - and installed the app in a different folder I chose that isn't the /Applications folder. I tried selecting it, but nope, doesn't work.

/Applications is set to these permissions:

drwxrwxr-x  48 root  admin  1536 Feb 20 22:07 Applications

I thought maybe something is wrong with my /Applications folder in terms of permissions. I cannot change its owner. I just wanted to mention that the regularuser I am currently using used to be a sudo user. when I discovered that when using the mac for regular stuff it's recommended to use a non-sudo user - I decided to create a new user to be the sudo user, and remove the sudo from the regularuser. I don't know if it has something to do with it.

edit:

regularuser@my-MacBook-Pro / % ls -al /usr/local
total 0
drwxr-xr-x   14 root    wheel   448 Feb 14 21:38 .
drwxr-xr-x@  11 root    wheel   352 Jan  1  2020 ..
drwxrwxr-x   11 regularuser  admin   352 Feb 20 23:10 Caskroom
drwxrwxr-x   54 regularuser  admin  1728 Feb 20 23:05 Cellar
drwxrwxr-x    4 regularuser  admin   128 Feb  8 21:55 Frameworks
drwxr-xr-x   21 regularuser  admin   672 Feb 19 21:39 Homebrew
drwxrwxr-x  210 regularuser  admin  6720 Feb 20 23:04 bin
drwxrwxr-x   10 regularuser  admin   320 Feb 20 22:25 etc
drwxrwxr-x   89 regularuser  admin  2848 Feb 20 23:04 include
drwxrwxr-x  218 regularuser  admin  6976 Feb 20 23:04 lib
drwxrwxr-x   69 regularuser  admin  2208 Feb 20 23:05 opt
drwxrwxr-x   20 regularuser  admin   640 Feb 11 21:10 sbin
drwxrwxr-x   33 regularuser  admin  1056 Feb 20 23:04 share
drwxrwxr-x    4 regularuser  admin   128 Feb 20 22:25 var
8
  • An alternate to my answer would be to just change your non-admin account to be admin - then run brew doctor after a reboot - and fix all the issues - then once brew is happy - disable the admin permissions, reboot a second time and check the work. I figured I'd go into the commands a bit. – bmike Feb 20 at 19:06
  • Let us continue this discussion in chat. – bmike Feb 20 at 20:00
  • @bmike some updates. no solution. – Kar19 Feb 20 at 21:29
  • @nohillside on my test mac, Caskroom wasn’t flagged and is different user and var was still owned by root... I rarely use casks so I’ve removed my answer – bmike Feb 20 at 21:49
  • 1
    So su - admin followed by chown -R admin /usr/local; brew doctor; brew update; brew upgrade should work. – nohillside Feb 20 at 21:53

You must log in to answer this question.

Browse other questions tagged .