Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

はじめに

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

やったぜ

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした