Permission Denied Error When Running install_gems.rb
search cancel

Permission Denied Error When Running install_gems.rb


Article ID: 102986


Updated On:


Rally On-Premise Rally SaaS


When running install_gems.rb, the following error is shows:
E:/Ruby22-x64/lib/ruby/2.2.0/open3.rb:193:in 'spawn': Permission denied - E:\Ruby22-x64\bin install rubygems-update -v 2.7.6  --no-ri --no-rdoc (Errno::EACCES)
    from E:/Ruby22-x64/lib/ruby/2.2.0/open3.rb:193:in 'popen_run'
    from E:/Ruby22-x64/lib/ruby/2.2.0/open3.rb:93:in 'popen3'
    from E:/Connector/install_gems.rb:73:in 'run_command'
    from E:/Connector/install_gems.rb:39:in 'block (2 levels) in main'
    from E:/Connector/install_gems.rb:37:in 'each'
    from E:/Connector/install_gems.rb:37:in 'block in main'
    from E:/Connector/install_gems.rb:35:in 'chdir'
    from E:/Connector/install_gems.rb:35:in 'main'
    from E:/Connector/install_gems.rb:84:in '<main>'


Operating System
  • Linux
  • Mac 
  • Windows

Any of the Ruby based work item connectors
  • HP ALM Connector
  • Team Foundation Server (TFS) Connector
  • Jira Connector



This is caused by having GEM_COMMAND set incorrectly.  In the example above, the install_gems.rb is actually trying to execute E:\Ruby22-x64\bin, which is a folder and not executable.

You can verify the GEM_COMMAND with the following commands:
  • Windows:
set | findstr -i GEM_COMMAND
  • Linux:
env | grep -i GEM_COMMAND


GEM_COMMAND should be set to point to the actual gem command in the ruby bin directory.

In the example above, ruby is installed in E:\Ruby22-x64.  The gem command is in the bin folder so GEM_COMMAND should be set to E:\Ruby22-x64\bin\gem

Additional Information

Any currently open command prompts will need to be closed in order to ensure that the updated environment variable is applied.

Make sure you are not overriding GEM_COMMAND in the User section of the environment variables as shown in the image below.  The System settings shows a valid configuration, however it is being overridden by the User variable which is incorrect.