Can't Install Or Run OpenShift RHC Client Tools On MAC OS X

- 1 answer

I'm trying to install and configure the OpenShift Client tools, in order to be able to install and run a WAR app.

I have been trying to follow rhc setup - command not found instructions but without success.

The point is that when I run gem install rhc-1.38.4.gem it fails because of permissions...

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

So I try to go with sudo: sudo gem install rhc-1.38.4.gem, and provide the pwd. Everything seems to be correct then...


If this is your first time installing the RHC tools, please run 'rhc setup'

Successfully installed rhc-1.38.4
Parsing documentation for rhc-1.38.4
Done installing documentation for rhc after 2 seconds
1 gem installed

However, rhc command give me the nightmare -bash: rhc: command not found error.

Then, I browse to the provided folder, in /Library/Ruby/Gems/2.0.0/rhc-1.38.4/, and there you can find all the rhc stuff as it was supposed to be:

COPYRIGHT   autocomplete    conf        lib
LICENSE     Rakefile    bin             features    spec

If I get into the bin folder, there is the rhc, but if I try to run it, I get the same error.

My git versión is 2.5.4 (Apple Git-61)

Ruby is ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]

Run on OS X 10.11.1

Sorry if I seem too rookie for this, but I have tried to run sh rhc, with this result:

rhc: line 2: require: command not found
rhc: line 4: def: command not found
rhc: line 5: ARGV.shift: command not found
rhc: line 6: args: command not found
rhc: line 8: syntax error near unexpected token `/\s/'
rhc: line 8: `    if ( a.to_s.strip.length == 0 || a.to_s.strip.match(/\s/) ); a = "'#{a}'" end'

As far as I understand, it's not a problem with the PATH, as reads this article.

I'm trying to follow the installation steps on here.

It will be much appreciated any help, plz.



The reason you are getting -bash: rhc: command not found is probably because you installed with sudo but you aren't running it as root. So you can try running it sudo rhc.

But if that works and you don't want to use sudo every time you have to run rhc you could fix the permissions on your gem directory so your user has access to write to it. In this case that directory is /Library/Ruby/Gems/2.0.0/. You can either open up the permissions on the directory with sudo chmod -R 777 /Library/Ruby/Gems/2.0.0/, or you could try to chown it to your user sudo chown /Library/Ruby/Gems/2.0.0/.

Alternatively, a less invasive solution would be to change your gem installation location to something local to your user, such as ~/.gem. This is probably something you should do anyway so that your local Ruby/gem environment doesn't conflict with system Ruby.