7

I had just installed homebrew and afterwards I installed Laravel Valet.
I am now not able to run any sudo commands at all, and it basically broke my computer.

This is the errors I get when running sudo in terminal

>>> /etc/sudoers.d/brew: Alias `BREW' already defined near line 1 <<<
>>> /etc/sudoers.d/valet: Alias `VALET' already defined near line 1 <<<
sudo: parse error in /etc/sudoers.d/brew near line 1
sudo: no valid sudoers sources found, quitting

Any help appreciated

This is my sudoer for /etc/sudoers.d/brew:

Cmnd_Alias BREW = /usr/local/bin/brew *
%admin ALL=(root) NOPASSWD: BREW

And this is my sudoer for /etc/sudoers.d/valet:

Cmnd_Alias VALET = /usr/local/bin/valet *
%admin ALL=(root) NOPASSWD: VALET
Oliver Nybroe
  • 1,828
  • 22
  • 30

1 Answers1

2

The problem seems when trying to disable password requirement for group admin or users brew and valet. Try to change each sudoers.d file to something as :

Cmnd_Alias BREW = /usr/local/bin/brew *
brew ALL=NOPASSWD: ALL

or in a general way, as inside admin group

Cmnd_Alias BREW = /usr/local/bin/brew *
%admin ALL=NOPASSWD: BREW
DvTr
  • 347
  • 1
  • 5
  • How do I change the sudoers without sudo access? When I run sudo I just get the error – Oliver Nybroe Oct 02 '16 at 11:29
  • It didn't work when I changed the sudoers like you wrote. – Oliver Nybroe Oct 03 '16 at 20:46
  • Had you rebooted? With that sudoers.d file, brew or any user does not need to put sudo password. Could you put here error message that appears to you? – DvTr Oct 05 '16 at 19:15
  • Yes I rebooted and the exact errors still came. I made some testing and by just deleting the sudoers.d files I was still able to use homebrew and valet without any problems. – Oliver Nybroe Oct 10 '16 at 07:01