brew install nmap で発生したインストール時のエラーをchownで解決

  • 14
    いいね
  • 0
    コメント
この記事は最終更新日から1年以上が経過しています。

はじめに

nmapを使おうとしてhomebrewからinstallしたらErrorが出たので解決(実はインストール時のErrorに気づかずCommand not foundで気づいた話)

環境

OS X 10.10.3
zsh 5.0.8

nmapのインストール

% brew install nmap  
==> Downloading https://homebrew.bintray.com/bottles/nmap-6.47.yosemite.bottle.2.
Already downloaded: /Library/Caches/Homebrew/nmap-6.47.yosemite.bottle.2.tar.gz
==> Pouring nmap-6.47.yosemite.bottle.2.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/de/man1/nmap.1
/usr/local/share/man/de/man1 is not writable.

You can try again using:
  brew link nmap
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
  mkdir -p /Users/ren/Library/Python/2.7/lib/python/site-packages
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/ren/Library/Python/2.7/lib/python/site-packages/homebrew.pth
==> Summary
🍺  /usr/local/Cellar/nmap/6.47: 659 files, 21M

途中でErrorが発生

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/de/man1/nmap.1
/usr/local/share/man/de/man1 is not writable.

/usr/local/にシンボリックリンクを貼ることができませんでしたとのことです・・・

原因究明

究明ってほどでもなくすぐに見つかった
いやぁbrew doctor便利便利

% brew doctor 
Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:
    /usr/local/share/man/de
    /usr/local/share/man/de/man1

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
    nmap 

解決(1つめのWarning)

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:
    /usr/local/share/man/de
    /usr/local/share/man/de/man1

特定のディレクトリ所有者がbrewを使うユーザになっていないため起きてる問題

% ls -la /usr/local/share/man | grep de
drwxr-xr-x     3 root  wheel    102  2 20  2013 de/

ディレクトリの所有者を変更

% sudo chown -R $USER /usr/local/share/man/de

解決(2つめのWarning)

% brew doctor                                
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
    nmap

あとは指示に従って、手動でシンボリックリンクを作成

% brew link nmap
Linking /usr/local/Cellar/nmap/6.47... 25 symlinks created

おもむろにnmapコマンドを確かめてみる

 % nmap -version

Nmap version 6.47 ( http://nmap.org )
Platform: x86_64-apple-darwin14.3.0
Compiled with: liblua-5.2.3 openssl-1.0.2a nmap-libpcre-7.6 libpcap-1.5.3 nmap-libdnet-1.12 ipv6
Compiled without:
Available nsock engines: kqueue poll select

動きました!