# Could not find default inventory in Mac

**URL:** <https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751>\
**Category:** Ansible Project\
**Created:** [March 16, 2015, 1:11pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751 "2015-03-16T13:11:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jialiang\_Liang](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@Jialiang\_Liang](https://forum.ansible.com/u/Jialiang_Liang)\
**Post date:** [March 16, 2015, 1:11pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751/1 "2015-03-16T13:11:07Z")

</div>

I installed ansible(1.8.4) with homebrew in Mac OSX Yosemite.

I followed ansible doc and create ‘hosts’ file under /etc/ansible, and try with the most simple ansible command:

ansible my\_inventory -m ping

and I got an error:

ERROR: Unable to find an inventory file, specify one with -i ?

Then I figured that the default inventory path became:

/usr/local/etc/ansible/hosts

And It works if I created a hosts file in this folder.

I am curious if this is behaviour is something related to the convention for homebrew? If so, should we change ansible documentation?

Also, I found that even I created ansible.cfg in my current folder and change default inventory like this

[defaults]  
inventory = $HOME/projects/ansible\_playbooks/hosts

I will still get the same error if I don’t have any inventory file in:

/usr/local/etc/ansible/hosts

How can I overwrite the defaults in the current directory?

Thanks

Leo Liang

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [March 16, 2015, 2:54pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751/2 "2015-03-16T14:54:24Z")

</div>

It is a convention of homebrew to install everything in /usr/local, to the point where they patch the source of applications to change paths.

I would not consider this something that should be updated in the ansible docs. Ideally, I would discourage anyone from installing ansible via homebrew, as it does some other nasty things that make it hard to extend and use.

Also within [defaults] the key has historically been called ‘hostfile’. As of the unreleased ansible 1.9, ‘hostfile’ is deprecated and the new option is ‘inventory’.

---

<div class="post-metadata">

**Author:** ![Jialiang\_Liang](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@Jialiang\_Liang](https://forum.ansible.com/u/Jialiang_Liang)\
**Post date:** [March 16, 2015, 11:12pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751/3 "2015-03-16T23:12:07Z")

</div>

Hi Matt,

Thanks for your quick reply.

I actually found the instruction in ansible docs to install “[Latest Releases Via Homebrew (Mac OSX)](http://docs.ansible.com/intro_installation.html#latest-releases-via-homebrew-mac-osx)”, if install ansible is discourage, do you think it is possible to have a warning in the installation page?

I am actually aware that ansible is going to deprecated ‘hostfile’ and that is why in my ansible.cfg, I used ‘inventory’ not ‘hostfile’. I guess option ‘inventory’ is not working prior 1.9?

Thanks again for your reply.

Leo Liang

在 2015年3月17日星期二 UTC+11上午1:55:10，Matt Martz写道：

---

<div class="post-metadata">

**Author:** ![Jialiang\_Liang](https://avatars.discourse-cdn.com/v4/letter/j/d9b06d/32.png) [@Jialiang\_Liang](https://forum.ansible.com/u/Jialiang_Liang)\
**Post date:** [March 16, 2015, 11:18pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751/4 "2015-03-16T23:18:14Z")

</div>

BTW, if Homebrew is not the best way to intsall Ansible in Mac OSX, then what is the best way you suggest to install Ansible in Mac OSX?

Cheers

Leo Liang

在 2015年3月17日星期二 UTC+11上午10:12:07，Jialiang Liang写道：

---

<div class="post-metadata">

**Author:** ![Martin2](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Martin2](https://forum.ansible.com/u/Martin2)\
**Post date:** [March 17, 2015, 12:35pm UTC](https://forum.ansible.com/t/could-not-find-default-inventory-in-mac/17751/5 "2015-03-17T12:35:48Z")

</div>

Hi,

With ansible being so “simple” I’d suggest this order of installation:

- virtualenv with pip install
- virtualenv with git checkout

With the current development speed and given that is indeed rather easy to run from git I’d think that anything else is just a major PITA. I’ve never even attempted to to anything but virtualenv and one of the above.

For “production” setups i usually use virtualenv+pip as I can nicely freeze the requirements, create a bootstrap script and send it around to colleagues which will then get exactly the versions that work.

(of course just my idea of how to actually use ansible)

/Martin
