dehio3’s diary

仕事、生活、趣味のメモ

mac(OS EI Capitan)にansibleをインストールしてみた

f:id:dehio3:20190711140040p:plain

背景

会社でansibleによるEC2インスタンスの作成を行っているがうまく起動しないので、勉強も兼ねて自宅のmacから個人のAWS環境にEC2インスタンスを作成してみようと思い立った!

Homebrewインストール

ansibleをmacにインストールするならHomebrewでインストールするのが楽とのことなのでまずはHomebrewをインストールしてみる事に。

Homebrewのインストール方法は以下を参照した。

パッケージ管理システム Homebrew - Qiita

java,xcode,Homebrewのインストールについては記載の通りに完了。

Homebrewのチェックにて以下のメッセージが出力。

$ 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/ublio.h

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile

2つ目のwarningは解決方法が記載されていたのでそのまま実行。

$ ls -l ~/.bash_profile
ls: /Users/hoge/.bash_profile: No such file or directory
$ echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile

1つ目のwarningは問題を引き起こす可能性がるから削除しろ的なことらしい。

http://roboneco.hateblo.jp/entry/2015/03/13/124536

でもそもそもどのpkgで使ってるファイルだ?

$ cat /usr/local/include/ublio.h
/*-
 * Copyright 2006 Csaba Henk <csaba.henk@creo.hu>
 * All rights reserved.

(中略)

/*
 * Minor modifications 2007-2009 for the NTFS-3G for Mac OS X project.
 *   Erik Larsson <erik82@kth.se>
 */

なんか「NTFS-3G for Mac OS X」なるpkgのようだが・・・

昔入れたpkgのようだけど今は必要ないからpkg毎削除しよう!!

まずはpkg名を確認。

$ pkgutil --pkgs | grep ntfs
org.catacombae.ntfs-3g_package

システム環境設定を開くとNTFS-3Gを発見。 f:id:dehio3:20160922081612p:plain

開いてstatusを「disable」に変更し、「Uninstall NTFS-3G...」ボタンを押そうとしてけど、白抜き状態で押せない。 f:id:dehio3:20160922081548p:plain

カーソルを合わせると「Uninstall script not found !!」が!!

以下のパッケージ削除スクリプトを利用し削除してみることに。

Macでインストールしたパッケージを削除する - Qiita

$ pkgutil --pkgs | grep ntfs
$ 

消えたようなので再度チェックを実行。

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: Broken symlinks were found. Remove them with `brew prune`:
    /usr/local/lib/libublio.1.0.0.dylib
    /usr/local/share/man/man8/mkfs.ntfs.8
    /usr/local/share/man/man8/mount.lowntfs-3g.8
    /usr/local/share/man/man8/mount.ntfs-3g.8

ファイル削除の結果、リンク切れしたシンボリックリンクが発生したという警告らしいので、指示通りのコマンドを実行。

$ brew prune
Pruned 4 symbolic links and 1 directories from /usr/local

再度チェック。

$ brew doctor
Your system is ready to brew.

バージョンチェック。

$ brew -v
Homebrew 1.0.0 (git revision a381b; last commit 2016-09-21)
Homebrew/homebrew-core (git revision 48e0; last commit 2016-09-21)

完了。

やっとansibleインストール

$ brew install ansible

インストールを確認

$ brew list
ansible libyaml openssl
$ ansible
ansible           ansible-doc       ansible-playbook  ansible-vault
ansible-console   ansible-galaxy    ansible-pull 

コマンドもいたのでインストールされたよう。