Ansible Install on OS X

1,307 views
Skip to first unread message

Matt Hughes

unread,
Sep 4, 2014, 10:41:43 AM9/4/14
to ansible...@googlegroups.com
I started out trying to use Ansible via Home Brew, but I needed to add a pip library (docker-py) and read that even Brew's ansible uses the systems python.  So I removed python and ansible completely from brew.

I then tried to install Ansible via the system pip.  Now I get 'bad interpreter' errors:


› brew list
ack                brew-cask            git-annex            jq                macvim                pcre                sysdig                watch
ant                cmake                gmp                jruby                md5sha1sum            pkg-config            the_silver_searcher        wget
apple-gcc42            cscope                gnupg                jsonpp                nettle                readline            tig                xmlstarlet
autojump            curl                gnutls                libevent            node                reattach-to-user-namespace    tmux                xz
bash                gdbm                go                libidn                openssl                rlwrap                tree                zsh-completions
bash-completion            gettext                grc                libtasn1            panamax                scala                vimpager            zsh-history-substring-search
bison                git                gsasl                libyaml                pandoc                sqlite                wakeonlan            zsh-syntax-highlighting

 in ansible/centos/
› which python
/usr/bin/python

 in ansible/centos/
› which ansible
/usr/local/bin/ansible

 in ansible/centos/
› ls -lh /usr/local/bin/ansible
-rwxr-xr-x  1 root  admin   7.9K Sep  3 21:39 /usr/local/bin/ansible

 in ansible/centos/
› ls -lh /usr/local/bin/ansible-playbook
-rwxr-xr-x  1 root  admin    12K Sep  3 21:39 /usr/local/bin/ansible-playbook

 in ansible/centos/
› ansible-playbook
zsh: /usr/local/bin/ansible-playbook: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory

 in ansible/centos/
› ansible
zsh: /usr/local/bin/ansible: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory



Any tips to either rescue my system install or make Brew's Ansible use Brew's pip library would be greatly appreciated.

Michael DeHaan

unread,
Sep 4, 2014, 10:54:22 AM9/4/14
to ansible...@googlegroups.com
(replying to thread this time)

*/bin/ansible-* uses "/usr/bin/env" to launch whatever python is in your path, which is pretty standard practice.

It seems like you might have /usr/bin/python symlinked to something that is a broken symlink or is not marked executable.

pip install on OS X is a fine way to do things.

We don't recommend homebrew because they have applied patches not in the main ansible tree, and have not contributed them back upstream, which makes it confusing when people report having installed from brew.

Another super easy way to run from OS X is to just do a checkout and:

source ./hacking/env-setup

Ansible runs very easy from source once deps are available.




--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9cd89cda-9bce-4276-986d-d3c14a9c27c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages