LoginSignup
3
2

More than 5 years have passed since last update.

zsh入れようとbrew install したらできなかった時の話

Last updated at Posted at 2018-02-22

はじめに

zsh入れようとbrew install したらできなかった時の話です

zshのインストール

何やらzshがいいらしいので早速入れようと

$ brew update
$ brew install zsh

したら

Error: Could not create /usr/local/Cellar
Check you have permission to write to /usr/local

が出てきた
あれ?writeじゃなくてcreate?

Error: Cannot write to /usr/local/Cellar

は前見たことあったがcreate?ってなってとりあえず調べると
sudoで直接ディレクトリ作ってる人がいたので真似してみる

$ sudo mkdir /usr/local/Cellar

てやった後にもう一度 brew install したら

Error: /usr/local/Cellar is not writable. You should  change the
ownership and permissions of /usr/local/Cellar back to your
user account:
  sudo chown -R $(whoami) /usr/local/Cellar
Error: Cannot write to /usr/local/Cellar

て出てきた....なんだこの安心感...okこれなら分かる
エラーに書いてある通りに

$ sudo chown -R $(whoami) /usr/local/Cellar

を入力してもう一回 brew install したら

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 zsh
==> Summary

よし!終わり.....あれ?なんか出てる?

まだなんか出てる

言われた通りに

$ brew link zsh

を入力すると

Linking /usr/local/Cellar/zsh/5.4.2_3... 
Error: Could not symlink .
/usr/local/opt is not writable.

が出てきた.....助けてDoctor!

$ brew doctor
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  zsh

言われた通りにすると

$ brew link zsh
Linking /usr/local/Cellar/zsh/5.4.2_3... 
Error: Could not symlink .
/usr/local/opt is not writable.

さっきと同じ
調べると

sudo chown -R `whoami`:admin /usr/local/opt

でいけるらしいがoptなんてないって言われたので
作ってからもう一回やると

$ sudo mkdir /usr/local/opt
$ sudo chown -R `whoami`:admin /usr/local/opt
$ brew link zsh
Linking /usr/local/Cellar/zsh/5.4.2_3... 1351 symlinks created

やったぜ

3
2
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
3
2