43

usr /local/内に標準の自作インストールがあります

私が試してみると:

Larson-2:~ larson$ brew install postgresql
Error: Cannot write to /usr/local/Cellar

そして、sudoを使用する場合:

Larson-2:~ larson$ sudo brew install postgresql
Cowardly refusing to `sudo brew install'

私は何が間違っているのですか?

4

7 に答える 7

124

どういうわけか、へのアクセス許可が制限されてい/usr/local/Cellarます。Brewはsudoを使用してインストールするのが好きではないため、拒否します。

権限を確認してください。

ls -ld /usr/local/Cellar

書くためにそれらを開いてください:

sudo chmod a+w /usr/local/Cellar

于 2012-03-21T07:53:46.157 に答える
9

(セキュリティ上の理由から)sudo作業中は使用しないでください。brew

権限を簡単に設定する必要があります。

したがって、さらに進んで、アクセス許可を次のように変更します。

sudo chgrp -R admin /usr/local /Library/Caches/Homebrew
sudo chmod -R g+w /usr/local /Library/Caches/Homebrew

次に、コマンドの使用を許可する必要があるユーザーに特定のグループ(またはのいずれadminか)を適用します。次の方法でユーザーのグループを確認します:) 。staffbrewid -Gn

さらに問題がある場合は、:brew doctorを実行して何が問題なのかを確認します。

于 2015-05-30T10:14:06.920 に答える
6

グループの権限を変更します。

$ chgrp -R admin /usr/local/Cellar
$ chmod g+w /usr/local/Cellar

ユーザーアカウントがグループ管理者であると仮定します。

于 2014-11-25T14:00:13.220 に答える
1

これは、マシンに複数のユーザーがいる場合にも発生します。もしそうなら、他のすべてのアプローチでは/ usr / local / Cellarだけでなく、はるかに多くのファイルやフォルダーをいじくり回すため、ユーザーを変更するのが最善です。

を使用しsu userWhoInstalledBrewます。

于 2015-11-23T09:47:39.577 に答える
0

この問題は、ディレクトリの所有者を現在のユーザーに変更することで解決できます。

sudo chown -R $USER /usr/local

この回答は、https ://github.com/Homebrew/homebrew/issues/17884から取得されます。

于 2016-03-18T13:53:14.963 に答える
0

brewのusr/local dirにセラーファイルがありませんでの彼の回答で提供されたアドバイスchukcha14に従って、私はこれを行いました:

jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community@4.2
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
Error: Could not create /usr/local/Cellar
Check you have permission to write to /usr/local
jaimes-mbp:SMR jaimemontoya$ sudo mkdir /usr/local/Cellar
Password:
jaimes-mbp:SMR jaimemontoya$ sudo chown $(whoami) /usr/local/Cellar
jaimes-mbp:SMR jaimemontoya$ brew install mongodb-community@4.2
Warning: You are using OS X 10.15.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
==> Installing mongodb-community from mongodb/homebrew-brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz
###################################################################################### 100.0%
Error: Failed to install plist file
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink .
/usr/local/opt is not writable.

You can try again using:
  brew link mongodb-community
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall mongodb/brew/mongodb-community`
==> Caveats
To have launchd start mongodb/brew/mongodb-community at login:
  ln -sfv /usr/local/opt/mongodb-community/*.plist ~/Library/LaunchAgents
Then to load mongodb/brew/mongodb-community now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
Or, if you don't want/need launchctl, you can just run:
  mongod --config /usr/local/etc/mongod.conf
==> Summary
  /usr/local/Cellar/mongodb-community/4.2.3: 20 files, 304M, built in 110 seconds
jaimes-mbp:SMR jaimemontoya$ sudo mkdir /usr/local/opt
jaimes-mbp:SMR jaimemontoya$ sudo chown $(whoami) /usr/local/opt
jaimes-mbp:SMR jaimemontoya$ brew link mongodb-community
Linking /usr/local/Cellar/mongodb-community/4.2.3... 13 symlinks created
jaimes-mbp:SMR jaimemontoya$ 
于 2020-03-13T12:05:40.820 に答える
0

おかしいError: Cannot write to /usr/local/Cellarですが、ディスク容量が足りないためにメッセージを受け取りました..:/(残り18MB)

于 2020-10-01T09:15:23.840 に答える