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

home brewをインストールする

  • OSバージョン
    • OSX EI captain 10.11.6

  • javaのバージョンを確認
$ java -version 

java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833) 
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode) 

javaは問題無し。

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

インストールされてなく、コマンドラインでベロッパーツールのインストールを促されたのでインストール。

数分でインストール完。再度コマンド実行しインストールされていることを確認。

$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

自分の環境には/usr/localはすでにあったが、アップデートでEI Captainにしている場合にはパーミッションの関係で
問題が発生する可能性があるらしい。以下のコマンドを実行してパーミッションを変更する。

$ sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local


home brewをインストールする。

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

-e:82: warning: Insecure world writable dir /Users/kenji/local in PATH, mode 040777
==> 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
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/bin
/usr/local/etc
/usr/local/opt
/usr/local/sbin
/usr/local/share
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod u+rwx share/zsh share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown kenji /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/kenji/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/kenji/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown kenji /Users/kenji/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 3376, done.
remote: Compressing objects: 100% (2395/2395), done.
remote: Total 3376 (delta 1544), reused 2156 (delta 847), pack-reused 0
Receiving objects: 100% (3376/3376), 2.17 MiB | 1.63 MiB/s, done.
Resolving deltas: 100% (1544/1544), 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
HEAD is now at 0546d90 Merge pull request #1251 from MikeMcQuaid/diagnostic-no-write-tmp
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3733, done.
remote: Compressing objects: 100% (3623/3623), done.
remote: Total 3733 (delta 10), reused 358 (delta 1), pack-reused 0
Receiving objects: 100% (3733/3733), 3.00 MiB | 3.08 MiB/s, done.
Resolving deltas: 100% (10/10), done.
Checking connectivity... done.
Tapped 3612 formulae (3,760 files, 9.3M)
Already up-to-date.
==> Installation successful!
==> Next steps
Run `brew help` to get started
Further documentation: https://git.io/brew-docs


不要なのかもしれないが、参考にしたサイトで実行していた以下のコマンドを実行。

$ 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: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
    /opt/local/bin/ncurses5-config
    /opt/local/bin/ncursesw5-config
    /opt/local/bin/pkg-config

Warning: You have MacPorts or Fink installed:
  /opt/local/bin/port

This can cause trouble. You don't have to uninstall them, but you may want to
temporarily move them out of the way, e.g.

  sudo mv /opt/local ~/macports

Warning: You have leftover files from an older version of Xcode.
You should delete them using:
  /Developer/Library/uninstall-developer-folder

Warning: You have a non-Homebrew 'pkg-config' in your PATH:
  /opt/local/bin/pkg-config

`./configure` may have problems finding brew-installed packages using
this other pkg-config.

Warning: The directory Xcode is reportedly installed to doesn't exist:
  /Developer/Applications/Xcode.app/Contents/Developer
You may need to `xcode-select` the proper path if you have moved Xcode.

Warning: Your Xcode (7.3) is outdated.
Please update to Xcode 8.0 (or delete it).
Xcode can be updated from the App Store.

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example, 
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path
-bash: You: command not found


macportsが入っていたので削除(すっかり忘れていた)

$ sudo port -fp uninstall --follow-dependents installed
Warning: port definitions are more than two weeks old, consider using selfupdate
--->  Deactivating bzip2 @1.0.6_0
--->  Uninstalling bzip2 @1.0.6_0
--->  Deactivating imake @1.0.3_0
--->  Uninstalling imake @1.0.3_0
--->  The following versions of sqlite3 are currently installed:
--->      sqlite3 @3.7.3_0
--->      sqlite3 @3.7.4_0 (active)
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
--->  The following versions of sqlite3 are currently installed:
--->      sqlite3 @3.7.3_0
--->      sqlite3 @3.7.4_0 (active)
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
--->  Deactivating perl5 @5.8.9_0
--->  Uninstalling perl5 @5.8.9_0
--->  Deactivating perl5.8 @5.8.9_3
--->  Uninstalling perl5.8 @5.8.9_3
--->  Uninstalling pkgconfig @0.25_1
--->  Deactivating pkgconfig @0.25_2
--->  Uninstalling pkgconfig @0.25_2
--->  The following versions of sqlite3 are currently installed:
--->      sqlite3 @3.7.3_0
--->      sqlite3 @3.7.4_0 (active)
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
--->  Uninstalling sqlite3 @3.7.3_0
--->  Deactivating sqlite3 @3.7.4_0
--->  Uninstalling sqlite3 @3.7.4_0
--->  Deactivating xorg-bigreqsproto @1.1.1_0
--->  Uninstalling xorg-bigreqsproto @1.1.1_0
--->  Uninstalling xorg-cf-files @1.0.3_0
--->  Deactivating xorg-cf-files @1.0.4_0
--->  Uninstalling xorg-cf-files @1.0.4_0
--->  Deactivating xorg-inputproto @2.0.1_0
--->  Uninstalling xorg-inputproto @2.0.1_0
--->  Deactivating xorg-kbproto @1.0.5_0
--->  Uninstalling xorg-kbproto @1.0.5_0
--->  Deactivating xorg-libXau @1.0.6_0
--->  Uninstalling xorg-libXau @1.0.6_0
--->  Deactivating xorg-libXdmcp @1.1.0_0
--->  Uninstalling xorg-libXdmcp @1.1.0_0
--->  Uninstalling xorg-xproto @7.0.19_0
--->  Deactivating xorg-xproto @7.0.20_0
--->  Uninstalling xorg-xproto @7.0.20_0

 sudo rm -rf \
>   /opt/local \
>   /Applications/DarwinPorts \
>   /Applications/MacPorts \
>   /Library/LaunchDaemons/org.macports.* \
>   /Library/Receipts/DarwinPorts*.pkg \
>   /Library/Receipts/MacPorts*.pkg \
>   /Library/StartupItems/DarwinPortsStartup \
>   /Library/Tcl/darwinports1.0 \
>   /Library/Tcl/macports1.0 \
>   ~/.macports


older version of Xcodeのファイルを削除する、メッセージのコマンドをそのまま叩いた。

$ sudo /Developer/Library/uninstall-developer-folder
Use of uninitialized value $pkgutil_volume_basename in concatenation (.) or string at /Developer/Library/uninstall-developer-folder line 35.
Start time: 20161010日 月曜日 094934秒 JST
Analyzing devtools package: 'com.apple.pkg.ApplicationLoader'...
Analyzing devtools package: 'com.apple.pkg.DashcodeLeo'...
Analyzing devtools package: 'com.apple.pkg.DevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DevSamplesLeo'...
Analyzing devtools package: 'com.apple.pkg.DevToolsDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImage4_0'...
Analyzing devtools package: 'com.apple.pkg.DeveloperDiskImageReleased'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsCLILeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsLeo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.5Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.6Leo'...
Analyzing devtools package: 'com.apple.pkg.OpenGLAppsLeo'...
Analyzing devtools package: 'com.apple.pkg.OtherDevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.X11DocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.clangLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0Leo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2Leo'...
Analyzing devtools package: 'com.apple.pkg.iPhoneDocumentation'...
Analyzing devtools package: 'com.apple.pkg.iPhoneHostSideTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_1_3'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKSnowLeopardExtras'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSDKTools'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK3_2'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDK4_0'...
Analyzing devtools package: 'com.apple.pkg.iPhoneSimulatorSDKTools'...
Analyzing devtools package: 'com.apple.pkg.llvm-gcc4.2Leo'...
Removing devtools files...
Removing generated files...
Removing Xcode Caches...
Removing Xcode Documentation...
Removing empty devtools directories...
Finish time: 20161010日 月曜日 095038秒 JST


Xcode 8.0をAppStoreからインストール。

PATHの設定で/usr/local/binを先に見るように設定を追加。

export PATH=/usr/local/bin:/usr/local/sin/:$PATH


再度brew doctorを実行。ようやくエラーなど出なくなった。

$ brew doctor
Your system is ready to brew.