LoginSignup
41
36

More than 1 year has passed since last update.

Macでbrew installをしたらPermissionで怒られた時の対処(簡易的に)

Last updated at Posted at 2016-04-06

現状

先日Qiita中の先生方々の中で画面遷移がMarkdown形式で記入できるというエディタをリリースされた方がいらっしゃいまして(■ここリンクです)参考にインストールをしましたところ、久々にbrewを使って躓いたので、ここにメモしました。

内容

graphvizとdotが必要(参考にした先生)なので、下記のコマンドでインストールしようとしたら、Permissionで怒られた。

~$ brew install graphviz
Error: Cannot write to /usr/local/Cellar

~$ sudo brew install graphviz
Error: Cannot write to /usr/local/Cellar

sudoを使ってもダメでした。よって直接/usr/local/Cellarの権限をいじりました。

方法

まずdoctorをします。

~$ brew doctor
多分あまりbrew周りをメンテナンスしていない人(自分)はwarningが結構出てきます。

Warning: /usr/local/Cellar isn't writable.
You should probably change the ownership and permissions of /usr/local/Cellar
back to your user account.
  sudo chown -R $(whoami) /usr/local/Cellar

を見つけたら、Cellarがwritableになっていない状態ですので、記載の通りにchownしてあげましょう。

まずいまログインしているユーザーを確認します。
~$ whoami
次にchownをしてあげます。
~$ sudo chown -R whoami /usr/local/Cellar

そうすると。素直に
~$ sudo brew install graphviz
が実行できると思います。

remote: Counting objects: 3657, done.
remote: Compressing objects: 100% (3540/3540), done.
remote: Total 3657 (delta 15), reused 1578 (delta 5), pack-reused 0
Receiving objects: 100% (3657/3657), 2.70 MiB | 512.00 KiB/s, done.
Resolving deltas: 100% (15/15), done.
==> Installing dependencies for graphviz: libpng
==> Installing graphviz dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.21.el_capitan.bo
######################################################################## 100.0%
==> Pouring libpng-1.6.21.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.21: 25 files, 1.2M
==> Installing graphviz
==> Downloading https://homebrew.bintray.com/bottles/graphviz-2.38.0.el_capitan.
######################################################################## 100.0%
==> Pouring graphviz-2.38.0.el_capitan.bottle.1.tar.gz
🍺  /usr/local/Cellar/graphviz/2.38.0: 506 files, 67M

こんな感じです。

以上になります。

41
36
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
41
36