読者です 読者をやめる 読者になる 読者になる

けつあご日記

きくちはやみのふぃくさーにしかなりたくない.ひゃっぽゆずっててんほういは,あり.

Homebrew Caskがなぜかインストール出来ないとき

Mac

環境:OSX El Capitan 10.11.6

emacsを使っていこうかと思って調べたら,Macデフォルトのemacsはバージョンが古い(22)らしいじゃないか.現在の最新は25らしいのでそれを入れたかった.

masutaka.net

$ brew cask install emacs

でインストールできるなんて素敵じゃないか.意気揚々とタイプ.

$ brew cask install emacs
Error: Unknown command: cask

うん,caskってのが入ってない.caskというのはhomebrewの拡張らしい.

qiita.com

$ brew tap caskroom/cask

# 古いの
$ brew install caskroom/cask/brew-cask

このどっちかでインストールできるとのこと.

$ brew install caskroom/cask/brew-cask
==> brew cask install caskroom/cask/brew-cask
Error: Unknown command: cask

cask入れるコマンド打ってるのにcaskがないよと仰るか.brewがおかしいときはとりあえずbrew doctorらしいので,

$ brew doctor
(中略)
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

これはいつも出るけど,確かにbrew updateなんてずっとしてない気がする.

$ brew --version
Homebrew 0.9.9 (git revision 3a12; last commit 2016-07-06)
Homebrew/homebrew-core (git revision e40d; last commit 2016-07-06)

うん.何ヶ月もしていなかった.のでやってみた.

$ brew update   
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
Error: update-report should not be called directly!

できない.検索してみたら,

$ brew prune

でいいらしい.
hkdnet.hatenablog.com

$ brew prune
Pruned 0 symbolic links and 2 directories from /usr/local
$ brew update

でアップデートがうまくいき,

$ brew tap caskroom/cask              

も動いた(最初のとコマンドを変えたのはなんとなく,多分どちらでも問題ないと思う).目的のemacsもインストールできた.

Homebrew-caskがインストール出来ない(Error: Unknown command: caskが出てしまう)ときはbrew updateを試してみよう,そこでもおかしかったらbrew pruneしてみよう,という話でした.