Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
30
Help us understand the problem. What is going on with this article?
@_ag

macOS High Sierra で Ansible 入れようとしたら失敗した。

More than 3 years have passed since last update.

Homebrew で Ansible 入れようとしたら失敗しました。
環境:macOS High Sierra 10.13

$ brew install ansible
==> Installing ansible dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.13.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.13.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/gdbm.h
/usr/local/include is not writable.
==> Installing ansible dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.1.7.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.1.7.high_sierra.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/yaml.h
/usr/local/include is not writable.
==> Installing ansible dependency: python
Warning: Building python from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

==> Downloading https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/python/2.7.14 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.14/share --datadir=/usr/local/Cellar/p
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.14
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python/2.7.14/share/python
==> Downloading https://files.pythonhosted.org/packages/a4/c8/9a7a47f683d54d83f648d37c3e180317f80dc126a304c45dc6663246233a/setuptools-36.5.0.zip
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
######################################################################## 100.0%
==> Downloading https://files.pythonhosted.org/packages/fa/b4/f9886517624a4dcb81a1d766f68034344b7565db69f13d52697222daeb72/wheel-0.30.0.tar.gz
######################################################################## 100.0%
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/lib
Error: Permission denied @ dir_s_mkdir - /usr/local/lib

/usr/local/lib とか /usr/local/include に書き込み権限がないみたいです。
解決策調べてたら、単純に sudo chown -R $(whoami) $(brew --prefix) で権限変更しろというのがあったのでやってみましたが失敗。

$ sudo chown -R $(whoami) $(brew --prefix)
chown: /usr/local: Operation not permitted

どうも High Sierra からは上記の操作ができなくなったようです。
https://github.com/Homebrew/brew/issues/3228

結論は上記リンクに書いてありますが、/usr/local/以下のディレクトリを個別に chown で対処できました。必要なディレクトリは先に mkdir しておく必要があります。

$ sudo mkdir /usr/local/lib
$ sudo mkdir /usr/local/include
$ sudo mkdir /usr/local/Frameworks
$ sudo mkdir /usr/local/Frameworks/Python.framework
$ sudo chown -R $(whoami) $(brew --prefix)/*

上記を実行後、Ansible インストールで失敗したところをやりなおして終了。

$ brew link gdbm
Linking /usr/local/Cellar/gdbm/1.13... 12 symlinks created
$ brew link libyaml
Linking /usr/local/Cellar/libyaml/0.1.7... 5 symlinks created
$ brew link python
Linking /usr/local/Cellar/python/2.7.14... 26 symlinks created
30
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
_ag
離島プログラマ

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
30
Help us understand the problem. What is going on with this article?