xcode-select: Error|nodebrewでnode.jsをインストールできなかったときの対処法
node.jsの勉強会に参加するため、macにnode.jsのインストールをしていたときのこと。
nodebrewはちゃんとインストールできたのだけど、
nodebrew install で node.js がインストールができなかった。
出てるエラーをみてみると
xcode-select: Error: No Xcode is selected. Use xcode-select -switch /Applications/Xcode.app to select /Applications/Xcode.app, or see the xcode-select manpage (man xcode-select) for further information.
とのこと。
どうやらxcode(私はxcodeは入れずにcommand line toolsだけ入れてるのでそっち)のパスがnodebrewに伝わっていないみたい。
そんな時の対処法ですです。
使用するxcodeを指定する
指示に従う
とりあえず、書いてある通りxcodeを選択してみる。
$ xcode-select -switch /Applications/Xcode.app
これでOK。
でも、私はここでエラーが出ちゃいました。
xcode-select: Error: Path "/Applications/Xcode.app" is not a directory.
/usr/binでパスを通す
困ってぐぐってみたところ、このサイトがヒット!
http://mkdir.g.hatena.ne.jp/ymrl/20120226/1330222634
Appleさんは Command Line Tools for Xcode というのを出していて、それを使えばこれまでのように "/usr/bin" の中にgccとかmakeとかがインストールされるらしい。
ふむふむ、なるほど。
command line tools は /usr/bin の中にいるらしいので、
さっきのパスを変更して実行してみる。(管理者権限が必要)
$ sudo xcode-select -switch /usr/bin
よしよし♪通ったぜ♪
再度インストール
このあとは不完全なままインストールしちゃったnode.jsを
nodebrewでアンインストールして
もう一度インストールしなせばいいみたい。あら楽ちん。
ついでにインストールしたnode.jsを選択して
ちゃんとうごいてるかチェックして、おしまい!
$ nodebrew uninstall v0.10.0 v0.10.0 uninstalled $nodebrew install latest .... $nodebrew use v0.10.0 use v0.10.0 $ node -v v0.10.0
でーきた!