趣味と物欲

博多天神界隈を本と文房具(万年筆とインク)と電子ガジェットを探して徘徊しています。

OpenCVを入れる前にHomebrewを入れるところで嵌ったのでメモ

当ブログではアフィリエイト広告を利用しています

 あとで読む

日経ソフトウェアの別冊付録が「5日でわかるOpenCVプログラミング入門」だったので、MacOpenCVを入れる方法を検索したら、まずHomebrew入れろと書いてあった。

見様見真似でコマンド叩いてみるが、失敗している。

$ 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


==> The Xcode Command Line Tools will be installed.


Press RETURN to continue or any other key to abort
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Password:
==> Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.1
==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ (macOS\ High\ Sierra\ version\ 10.13)\ for\ Xcode-10.1
Software Update Tool


Installing Command Line Tools (macOS High Sierra version 10.13) for Xcode
Error downloading Command Line Tools (macOS High Sierra version 10.13) for Xcode: “Command Line Tools (macOS High Sierra version 10.13) for Xcode” could not be verified.
Done.


Error downloading updates.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
Failed during: /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools

Xcodeのcommand line toolsのpathが違うみたいなので、

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools/'

対処法を探すと、手動でダウンロードして入れろとのこと、

入れたら、pathが変わって、

$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password:
$ xcode-select --print-path
/Library/Developer/CommandLineTools

Homebrewも入りました。

$ 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: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 118003 (delta 21), reused 29 (delta 21), pack-reused 117948
Receiving objects: 100% (118003/118003), 27.93 MiB | 2.71 MiB/s, done.
Resolving deltas: 100% (86195/86195), done.
From https://github.com/Homebrew/brew


==> Installation successful!

とりあえず、またいつか嵌りそうなのでメモしときます。