4

When I try to do anything with Homebrew, I get the following error and don't know how to resolve it. I run: brew update

I get the following error message:

/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 19:/usr/local/var/homebrew/locks/update: Permission denied
    -e:1:in 'initialize': Bad file descriptor (Errno::EBADF)
        from -e:1:in 'new'
        from -e:1:in '<main>'
    Error: Another active Homebrew process is already in progress. 
    Please wait for it to finish or terminate it to continue.
Ouroborus
  • 16,237
  • 4
  • 39
  • 62
Erik P.
  • 349
  • 3
  • 13

2 Answers2

21

That's probably because another instance of Homebrew crashed and left a lock file. You can delete it manually by deleting all files in the lock directory with :

rm $(brew --prefix)/var/homebrew/locks/*
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
  • Better: `rm $(brew --prefix)/var/homebrew/locks/*` (in case Homebrew configured to use different directories). The `brew(1)` manual page says Intel/Arm MacOS and Linux each have distinct configuration for Homebrew's install path. – FooF Jan 13 '23 at 09:37
2

I solved it by rm -rf /usr/local/Library/Locks/*