# hacking/env-setup prefixes not working on Mac with Ansible install

**URL:** <https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580>\
**Category:** Ansible Developer\
**Created:** [February 17, 2014, 8:05pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580 "2014-02-17T20:05:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magnus\_Andersson](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Magnus\_Andersson](https://forum.ansible.com/u/Magnus_Andersson)\
**Post date:** [February 17, 2014, 8:05pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/1 "2014-02-17T20:05:15Z")

</div>

Hi

hacking/env-setup does not work for me. I’m on a Mac with a previous installation of Ansible via homebrew. The cause is easy to spot, but I’m wondering if there is a specific reason why it is setup in this way.

Before running env-setup:  
which ansible \> /usr/local/bin/ansible

echo $PATH \> /Users/magnus/google-cloud-sdk/bin:/usr/local/bin:/usr/local/share/npm/bin/:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/ **usr/local/bin** :/opt/X11/bin

I have ansible at the end of my path env variable.

Running env-setup:

PATH=/Users/magnus/Documents/Programmering/Magnusart/ansible/bin:/Users/magnus/google-cloud-sdk/bin:/usr/local/bin:/usr/local/share/npm/bin/:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

which ansible \> /usr/local/bin/ansible

Since the hacking env-setup prefixes the path instead of postfixing the current installation of ansible is still active.

Looking in env-setup it prefixes the PATH with the path to the development instance of ansible, is there a particular purpose for this?

/Magnus

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [February 17, 2014, 8:08pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/2 "2014-02-17T20:08:00Z")

</div>

“Since the hacking env-setup prefixes the path instead of postfixing the current installation of ansible is still active.”

Doesn’t compute.

First path wins in PATH, not the last, so prefixing is entirely correct.

[http://en.wikipedia.org/wiki/PATH\_(variable)](http://en.wikipedia.org/wiki/PATH_(variable))

---

<div class="post-metadata">

**Author:** ![Magnus\_Andersson](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Magnus\_Andersson](https://forum.ansible.com/u/Magnus_Andersson)\
**Post date:** [February 17, 2014, 8:15pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/3 "2014-02-17T20:15:41Z")

</div>

Hi

You’re right _blush_.

I did figure it was very strange since I also remembered that prefix would win, but I did try it out before posting. Now I see that the issue must be something else since it seems /usr/local/bin/ansible is called both before and after running env-setup (I’m in the same session so I’m very confused).

I must be tired, gonna give this a new try.

/Magnus

---

<div class="post-metadata">

**Author:** ![Magnus\_Andersson](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Magnus\_Andersson](https://forum.ansible.com/u/Magnus_Andersson)\
**Post date:** [February 17, 2014, 8:21pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/4 "2014-02-17T20:21:02Z")

</div>

The problem is that it does not get set at all. It looks as if it was judging by the output but when echoing $PATH it is not present. I was fooled by the output from the script.

When I add the path manually (export PATH=mypath:$PATH) it works.

/Magnus

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [February 17, 2014, 8:40pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/5 "2014-02-17T20:40:24Z")

</div>

You need to source the script not just run it.

– Michael

---

<div class="post-metadata">

**Author:** ![Magnus\_Andersson](https://avatars.discourse-cdn.com/v4/letter/m/7ab992/32.png) [@Magnus\_Andersson](https://forum.ansible.com/u/Magnus_Andersson)\
**Post date:** [February 17, 2014, 8:52pm UTC](https://forum.ansible.com/t/hacking-env-setup-prefixes-not-working-on-mac-with-ansible-install/14580/6 "2014-02-17T20:52:20Z")

</div>

Ah! There we go. Thanks.
