brew: brew update : Bad file descriptor (Errno::EBADF)

  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • If you’re seeing permission errors tried running sudo chown -R $(whoami) $(brew --prefix)?

Bug reports:

brew update fails.

steps taken [1] ls -la $(brew --prefix)

drwxrwxr-x  19 ram   admin   646 May 16 00:12 .
drwxr-xr-x@ 13 root  wheel   442 May 15 17:17 ..
drwxr-xr-x  14 ram   admin   476 May 18 22:57 .git
drwxr-xr-x   5 ram   admin   170 May 15 17:18 .github
-rw-r--r--   1 ram   admin  1016 May 15 17:18 .gitignore
-rw-r--r--   1 ram   admin   861 May 15 17:18 .travis.yml
-rw-r--r--   1 ram   admin   291 May 15 17:18 .yardopts
-rw-r--r--   1 ram   admin  3161 May 15 17:18 CODEOFCONDUCT.md
drwxr-xr-x  11 ram   admin   374 May 16 00:39 Cellar
-rw-r--r--   1 ram   admin  1241 May 15 17:18 LICENSE.txt
drwxr-xr-x  11 ram   admin   374 May 15 17:32 Library
-rw-r--r--   1 ram   admin  3918 May 15 17:18 README.md
drwxr-xr-x  94 ram   admin  3196 May 18 22:50 bin
drwxr-xr-x   5 ram   admin   170 May 16 00:36 etc
drwxr-xr-x   4 ram   admin   136 May 16 00:31 include
drwxr-xr-x  12 ram   admin   408 May 16 00:31 lib
drwxr-xr-x  11 ram   admin   374 May 16 00:39 opt
drwxr-xr-x  16 ram   admin   544 May 17 20:27 share
drwxr-xr-x   5 ram   admin   170 May 16 00:36 var

[2] brew doctor

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 and just ignore them. Thanks!

Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

[3] brew update

-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.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same issue, my problem was that I run a sudo command that probably affected some permissions, so to fix Homebrew I first run the following command to fix the permissions:

sudo chown -R "$USER":admin /usr/local

After that I did a cleanup:

brew cleanup

And I was successfully able to update Homebrew and install packages. Hope this helps!

@rochastuff helped me!

Try to cd /usr/local; git reset --hard origin/master; brew update.

CC @xu-cheng for what looks like a locking bug.