
MacにHomebrewをインストールする(node.jsでworning)
MacにHomebrewをインストールします。
Homebrewとはなんぞや、ということを簡単に説明しておくと、OS X上で動くパッケージマネージャーということになります。
ターミナルからのコマンドでソフトウェアのインストールやアップデートなどを楽にできるようにするものですね。
Mac使いのエンジニアであれば、あまり意識せずに普通に使ってると思いますけど。
さて、インストール手順です。
Xcodeのインストール
Homebrewのインストールには、Command Line Tools for Xcodeが必要なので、まずXcode自体のインストールが必要です。
Xcodeは4G近くある、バカでかいアプリで、最初ポケットWiFiでインストールしようとしたんですが、あまりに遅くて諦めました。
通信状況のいいところでやりましょう。
Xcodeのインストールは、App Storeからできます。
Command Line Tools for Xcode のインストール
ターミナルを立ち上げて、下記コマンドを実行。
1 2 |
$ xcode-select --install |
インストールするか聞かれるので、「インストール」ボタンを押して実行。
使用許諾に同意してインストールします。
Homebrewのインストール
Homebrewのサイトに行くと、インストールするには下記のコマンドを実行しろと書いてあるので、コピペしてきて実行します。
1 2 |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
実行すると、こんな感じでインストールが進んで、最後に「Installation successful!」と表示されれば、めでたくインストール成功です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew Press RETURN to continue or any other key to abort ==> Downloading and installing Homebrew... remote: Counting objects: 6003, done. remote: Compressing objects: 100% (3702/3702), done. remote: Total 6003 (delta 3385), reused 3974 (delta 2111), pack-reused 0 Receiving objects: 100% (6003/6003), 3.45 MiB | 2.79 MiB/s, done. Resolving deltas: 100% (3385/3385), done. From https://github.com/Homebrew/brew * [new branch] master -> origin/master * [new tag] 0.1 -> 0.1 * [new tag] 0.2 -> 0.2 * [new tag] 0.3 -> 0.3 * [new tag] 0.4 -> 0.4 * [new tag] 0.5 -> 0.5 * [new tag] 0.6 -> 0.6 * [new tag] 0.7 -> 0.7 * [new tag] 0.7.1 -> 0.7.1 * [new tag] 0.8 -> 0.8 * [new tag] 0.8.1 -> 0.8.1 * [new tag] 0.9 -> 0.9 * [new tag] 0.9.1 -> 0.9.1 * [new tag] 0.9.2 -> 0.9.2 * [new tag] 0.9.3 -> 0.9.3 * [new tag] 0.9.4 -> 0.9.4 * [new tag] 0.9.5 -> 0.9.5 * [new tag] 0.9.8 -> 0.9.8 * [new tag] 0.9.9 -> 0.9.9 * [new tag] 1.0.0 -> 1.0.0 * [new tag] 1.0.1 -> 1.0.1 * [new tag] 1.0.2 -> 1.0.2 * [new tag] 1.0.3 -> 1.0.3 * [new tag] 1.0.4 -> 1.0.4 * [new tag] 1.0.5 -> 1.0.5 * [new tag] 1.0.6 -> 1.0.6 * [new tag] 1.0.7 -> 1.0.7 * [new tag] 1.0.8 -> 1.0.8 * [new tag] 1.0.9 -> 1.0.9 * [new tag] 1.1.0 -> 1.1.0 * [new tag] 1.1.1 -> 1.1.1 * [new tag] 1.1.10 -> 1.1.10 * [new tag] 1.1.11 -> 1.1.11 * [new tag] 1.1.12 -> 1.1.12 * [new tag] 1.1.13 -> 1.1.13 * [new tag] 1.1.2 -> 1.1.2 * [new tag] 1.1.3 -> 1.1.3 * [new tag] 1.1.4 -> 1.1.4 * [new tag] 1.1.5 -> 1.1.5 * [new tag] 1.1.6 -> 1.1.6 * [new tag] 1.1.7 -> 1.1.7 * [new tag] 1.1.8 -> 1.1.8 * [new tag] 1.1.9 -> 1.1.9 * [new tag] 1.2.0 -> 1.2.0 HEAD is now at ea8be17 Merge pull request #2631 from GauthamGoli/audit_homepage_rubocop ==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Counting objects: 4409, done. remote: Compressing objects: 100% (4215/4215), done. remote: Total 4409 (delta 36), reused 451 (delta 14), pack-reused 0 Receiving objects: 100% (4409/4409), 3.50 MiB | 3.17 MiB/s, done. Resolving deltas: 100% (36/36), done. Tapped 4214 formulae (4,452 files, 10.9MB) ==> Cleaning up /Library/Caches/Homebrew... ==> Migrating /Library/Caches/Homebrew to /Users/satoshimiyazaki/Library/Caches/Homebrew... ==> Deleting /Library/Caches/Homebrew... Already up-to-date. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate user behaviour analytics. Read the analytics documentation (and how to opt-out) here: http://docs.brew.sh/Analytics.html ==> Next steps: - Run `brew help` to get started - Further documentation: http://docs.brew.sh |
brew doctorの実行
Homebrewが問題なくインストールできているか確認のため、brew doctorを実行します。
ターミナルから下記コマンドを実行。
1 2 |
$ brew doctor |
そしたら、こんなWorningが……
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: Unbrewed header files were found in /usr/local/include. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted. Unexpected header files: /usr/local/include/node/android-ifaddrs.h /usr/local/include/node/ares.h /usr/local/include/node/ares_build.h … |
これらのファイルを消す必要があるかも、ってことらしいんだが、よく見たら全部node.jsのヘッダーファイルばかり。
軽く調べてみると、stack overflowで下記回答が。
Brew doctor – “warning: unbrewed header files were found in /usr/local/include”?
- 気にしない。
- node.jsをHomebrewから再インストールする。
どうやら、先にnode.jsをインストーラでインストールしてしまったのが問題らしいですね。
…失敗した。
再インストールが面倒なので、とりあえず1のソリューションを選択しましょうか。
アップデートの確認
念のため、アップデートがないか確認しておきましょう。
下記コマンドを実行。
1 2 |
$ brew update |
なんか、アップデートがあったらしい。
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ brew update Updated 1 tap (homebrew/core). ==> New Formulae cockroach ==> Updated Formulae arangodb datomic halibut mldonkey traildb aws-sdk-cpp elixir ipfs quantlib vagrant-completion awscli fades libfabric shellshare weechat bit ffmpeg libmaxminddb sysbench ykpers bitlbee folly linkerd sysdig certigo geoip luvit tbb convox gnupg miniupnpc telegraf |
以上、終了〜。