Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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