Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to build a RPM using the mock build system. However, the shell in the mock environment cannot seem to find the ruby command. I run in to a build error:

sh: ruby: command not found

I can see that ruby is installed in the mock environment as it is a BuildRequires dependency of the spec file:

DEBUG util.py:257:  Getting requirements for thrift-0.8.0-1.el6.src
DEBUG util.py:257:   --> byacc-1.9.20070509-6.1.el6.x86_64
DEBUG util.py:257:   --> boost-devel-1.41.0-11.el6_1.2.x86_64
DEBUG util.py:257:   --> dos2unix-3.1-37.el6.x86_64
DEBUG util.py:257:   --> flex-2.5.35-8.el6.x86_64
DEBUG util.py:257:   --> libevent-devel-1.4.13-1.el6.x86_64
DEBUG util.py:257:   --> libtool-2.2.6-15.5.el6.x86_64
DEBUG util.py:257:   --> zlib-devel-1.2.3-27.el6.x86_64
DEBUG util.py:257:   --> openssl-devel-1.0.0-20.el6_2.3.x86_64
DEBUG util.py:257:   --> git-1.7.1-2.el6_0.1.x86_64
DEBUG util.py:257:   --> erlang-R14B-04.1.el6.x86_64
DEBUG util.py:257:   --> 4:perl-devel-5.10.1-119.el6_1.1.x86_64
DEBUG util.py:257:   --> php-devel-5.3.3-3.el6_2.6.x86_64
DEBUG util.py:257:   --> python-devel-2.6.6-29.el6.x86_64
DEBUG util.py:257:   --> ruby-
DEBUG util.py:257:   --> ruby-devel-

If I install ruby manually in the mock environment the shell can use it just fine:

[ashinn@rpmbuilder ~]$ mock -q --shell "ruby -v"
/bin/bash: ruby: command not found
[ashinn@rpmbuilder ~]$ mock -q --install ruby
[ashinn@rpmbuilder ~]$ mock -q --shell "ruby -v"
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
[ashinn@rpmbuilder ~]$

But the build still fails even if I run with --no-clean. The one thing that stands out to me is that the mock --shell failed with /bin/bash. But the rpmbuild output failed with /bin/sh.

Why the difference in shell and could that cause the issue?

share|improve this question
Does all the mock output indicate that the ruby package was actually installed? –  Ignacio Vazquez-Abrams Apr 23 '12 at 3:54
I am pretty sure. If I init and build with --no-clean it leaves ruby installed and I can exec it with mock -q --shell "ruby -v" –  Andy Shinn Apr 23 '12 at 16:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.