# msg: Failed to find required executable gem

**URL:** <https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841>\
**Category:** Ansible Project\
**Created:** [August 2, 2014, 4:09am UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841 "2014-08-02T04:09:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tze\_Yang\_Ng](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Tze\_Yang\_Ng](https://forum.ansible.com/u/Tze_Yang_Ng)\
**Post date:** [August 2, 2014, 4:09am UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/1 "2014-08-02T04:09:26Z")

</div>

Hi,

I am new to Vagrant and Ansible. Trying to use a playbook to install compass using gem command but got the following error. Seem like i miss some setting on env?

TASK: [ruby | Ruby | Install compass gem] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

failed: [default] =\> {“failed”: true}

msg: Failed to find required executable gem

FATAL: all hosts have already failed – aborting

This is the playbook content:

---

<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:** [August 2, 2014, 5:49pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/2 "2014-08-02T17:49:54Z")

</div>

What version of Ansible are you running?

ansible-playbook --version

---

<div class="post-metadata">

**Author:** ![Tze\_Yang\_Ng](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Tze\_Yang\_Ng](https://forum.ansible.com/u/Tze_Yang_Ng)\
**Post date:** [August 2, 2014, 7:48pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/3 "2014-08-02T19:48:41Z")

</div>

ansible-playbook 1.7 (devel 27a73f2c11) last updated 2014/08/01 15:00:46 (GMT -500)

---

<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:** [August 3, 2014, 4:15pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/4 "2014-08-03T16:15:16Z")

</div>

Sounds like you may need to pass the executable parameter.

[http://docs.ansible.com/gem\_module.html](http://docs.ansible.com/gem_module.html)

---

<div class="post-metadata">

**Author:** ![Tze\_Yang\_Ng](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Tze\_Yang\_Ng](https://forum.ansible.com/u/Tze_Yang_Ng)\
**Post date:** [August 3, 2014, 5:32pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/5 "2014-08-03T17:32:51Z")

</div>

Don’t think that is the issue, i already tried below before.Same issue.

---

<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:** [August 3, 2014, 6:28pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/6 "2014-08-03T18:28:59Z")

</div>

FWIW, in what you have pasted above, you are not passing the executable parameter.

Where is the gem executable on your machine?

---

<div class="post-metadata">

**Author:** ![Dick\_Davies](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@Dick\_Davies](https://forum.ansible.com/u/Dick_Davies)\
**Post date:** [August 3, 2014, 10:07pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/7 "2014-08-03T22:07:49Z")

</div>

Where is the gem command on your system?

---

<div class="post-metadata">

**Author:** ![Tze\_Yang\_Ng](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Tze\_Yang\_Ng](https://forum.ansible.com/u/Tze_Yang_Ng)\
**Post date:** [August 4, 2014, 1:43am UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/8 "2014-08-04T01:43:31Z")

</div>

RubyGems Environment:

- RUBYGEMS VERSION: 1.6.2

- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [i686-linux]

- INSTALLATION DIRECTORY: /opt/vagrant\_ruby/lib/ruby/gems/1.8

- RUBY EXECUTABLE: /opt/vagrant\_ruby/bin/ruby

- EXECUTABLE DIRECTORY: /opt/vagrant\_ruby/bin

- RUBYGEMS PLATFORMS:

- ruby

- x86-linux

- GEM PATHS:

- /opt/vagrant\_ruby/lib/ruby/gems/1.8

- /home/vagrant/.gem/ruby/1.8

- GEM CONFIGURATION:

- :update\_sources =\> true

- :verbose =\> true

- :benchmark =\> false

- :backtrace =\> false

- :bulk\_threshold =\> 1000

- REMOTE SOURCES:

- [http://rubygems.org/](http://rubygems.org/)

---

<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:** [August 4, 2014, 12:06pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/9 "2014-08-04T12:06:14Z")

</div>

Looks like you definitely need to pass the executable flag again.

I know you said you tried this, so if so, please show the playbook and the output. Otherwise, I’m going off the paste above that shows it not being passed 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![Tze\_Yang\_Ng](https://avatars.discourse-cdn.com/v4/letter/t/e47c2d/32.png) [@Tze\_Yang\_Ng](https://forum.ansible.com/u/Tze_Yang_Ng)\
**Post date:** [August 6, 2014, 4:34am UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/10 "2014-08-06T04:34:43Z")

</div>

Thanks. Finally this time around it work, i might type some things wrong last time.

Just a follow-up question, what is the expected default path to avoid providing the executable path? thanks.

---

<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:** [August 6, 2014, 3:17pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/11 "2014-08-06T15:17:21Z")

</div>

If not specified, it will look in the standard system path.

Note that ansible will take measures to ensure any user config (.bashrc) is not loaded, because it wants things to be predictable and repeatable, so this would be the normal things like /usr/bin/gem, etc, where you would find gem if you did a normal OS package install (like yum/apt).

---

<div class="post-metadata">

**Author:** ![yaron\_idan](https://avatars.discourse-cdn.com/v4/letter/y/ea5d25/32.png) [@yaron\_idan](https://forum.ansible.com/u/yaron_idan)\
**Post date:** [February 18, 2016, 4:37pm UTC](https://forum.ansible.com/t/msg-failed-to-find-required-executable-gem/15841/12 "2016-02-18T16:37:52Z")

</div>

I’m also receiving an error when trying to install compass using a playbook (on an AWS EC2 instance)  
Usually we use the following script to install compass -

```auto
curl -L https://get.rvm.io | bash -s stable
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.2
rvm use 2.1.2 --default
gem install compass

```

I’ve tried converting this to script to the following playbook -
