Homebrew on Mojave : issue : line 27: /usr/local/var/homebrew/locks/update : Permission denied

J’ai essayé de faire une installation de cmake, et j’ai eu l’erreur :

$ brew install cmake
/usr/local/Homebrew/Library/Homebrew/utils/lock.sh: line 27: /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 ' Error: Another active Homebrew update process is already in progress. Please wait for it to finish or terminate it to continue. Error: The following directories are not writable by your user: ...

Pour fixer le problème j’ai fait :

$ sudo chown -R $(whoami) /usr/local/Homebrew/
...
$ sudo chown -R $(whoami) /usr/local/var/homebrew/
...

Ensuite j’ai pu faire l’installation de cmake :

$ brew install cmake
Updating Homebrew...
To restore the stashed changes to /usr/local/Homebrew run:
  'cd /usr/local/Homebrew && git stash pop'
To restore the stashed changes to /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core run:
  'cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core && git stash pop'
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/services).
==> New Formulae
...
==> Renamed Formulae
gtksourceview@4 -> gtksourceview4          hh -> hstr                                 php72 -> php@7.2                           todolist -> ultralist
gutenberg -> zola                          mat -> mat2                                resin-cli -> balena-cli
==> Deleted Formulae
apple-gcc42             cputhrottle             hachoir-metadata        liblastfm               onepass                 pxz                     ruby@1.8
aptly-completion        datomic                 heroku                  lsh                     open-vcdiff             pyexiv2                 ruby@2.2
asciinema2gif           ffmbc                   hyper                   maven@3.0               opensyobon              qt@5.5                  sary
casperjs                gjstest                 ib                      maven@3.1               percona-server@5.6      queequeg                sickbeard
cctools                 gnome-doc-utils         juju-quickstart         mimms                   php@5.6                 reclass                 sonarlint
cctools-headers         gradle@2.14             kibana@4.4              nesemu2                 php@7.0                 redis@2.8               taylor
corebird                gv                      ld64                    nethack4                pldebugger              rock                    tcptrack

==> Downloading https://homebrew.bintray.com/bottles/cmake-3.13.4.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cmake-3.13.4.mojave.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cmake
==> Summary
?  /usr/local/Cellar/cmake/3.13.4: 5,543 files, 50.4MB

A suivre.