Recently I am trying to install Ruby on my Windows 10. After the installation process whenever I am trying to run any ruby command such as to check the version of Ruby, I command ruby -v and I got Access denied notifications.
For better purpose I am giving the screenshot of the problem I am facing:
PS: I am using rubyinstaller-2.4.1-2-x64 to install Ruby.
Related
I'm trying to run a ruby script where I used the exiftool gem, and everytime I'm trying to run it I keep getting this error even after installed it. Also, after running bundler as well.
Traceback (most recent call last):
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/exiftool-1.2.4/lib/exiftool.rb:60:in `initialize': Exiftool::ExiftoolNotInstalled (Exiftool::ExiftoolNotInstalled)
Also, it is running on my cmd. I tried testing it using the irb and the Exiftool isn't being recognized by ruby.
I'm maintainer of the exiftool.rb and exiftool_vendored.rb repos. #Zeragamba is correct that gem doesn't support Windows environments. The need for running it on Windows hasn't been brought up to our attention in the past 10 years. I've looked at the issue and cut a separate branch that should work with Windows, however I'm not planning to fully support Windows unless there is an overwhelming demand. There are a few gotchas related to implementing Windows support and I'm not sure if it's worth the time and effort to solve them at this point.
Couple of things that you would need to do to get it working:
If installed, remove exiftool_vendored.rb gem from your Windows system - it installs perl version of the exiftool from Phil Harvey.
Make sure that you are able to run git client commands in your PowerShell prompt
I've tested the following setup on Windows 10 and ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]
Download and install Windows executable from Phil Harvey's Exiftool site make sure that exiftool is in your PATH and can be executed in the PowerShell
Create following Gemfile:
source 'https://rubygems.org'
gem 'exiftool', github: 'exiftool-rb/exiftool.rb', branch: 'win_support'
Run bundle install to get exiftool from that branch.
Create a test.rb file to test test the installation:
require 'exiftool'
puts "Exiftool command: #{Exiftool.command}"
puts "Is Exiftool Installed?: #{Exiftool.exiftool_installed?}"
puts "Exiftool version: #{Exiftool.exiftool_version}"
After running it you should get something along these lines:
PS C:\Users\sergey>ruby .\test.rb
Exiftool command: exiftool
Is Exiftool Installed?: true
Exiftool version: 12.40
Once again please keep in mind that this isn't an official version that supports Windows environment. Feel free to open an issue on the github if you strongly feel that gem needs to support Windows environments, PRs are always welcome as well.
Thanks.
Looks like the exiftool gem does not currently support windows environments. It often appends 2> /dev/null/ when running shell commands.
You could potentually try running the script under WSL, or could try invoking the commands directly.
I am writing app for deployment. I have working rbenv environment on Debian 10. For all users, rbenv is initalized properly, so in project directories proper ruby version is used.
But when I try to run from web app using Kernel.system or just ``, it fails, it is used Ruby version of my web-app. I am trying to initalize it but in $PATH is still bad version.
If I use /var/www/.rbenv/bin/rbenv local then ruby -v prints proper version, but mina deployment fails trying to load gems from local vendor directory of web app project.
When I do this from padrino console usning system():
/var/www/.rbenv/bin/rbenv local && ruby -v
It returns
"2.6.5\nruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]\n"
So rbenv local works fine but another command uses bad ruby version.
Please is there any way to initialize proper version?
EDIT: Answers to questions.
It is web app for deploying on local server of another ruby apps, we have a lots of versions. Web app is running (just this app) on Ruby 3.0.0. I am executing command inside directory of app which I want to deploy (Ruby 2.6.5) using mina, but it failed.
which ruby from padrino console
/var/www/.rbenv/versions/3.0.0/bin/ruby\n
And PATH
=> "/var/www/production/deploy/releases/77/vendor/bundle/ruby/3.0.0/bin:/var/www/.rbenv/versions/3.0.0/bin:/var/www/.rbenv/libexec:/var/www/.rbenv/plugins/ruby-build/bin:/var/www/.rbenv/plugins/rbenv-vars/bin:/var/www/.rbenv/shims:/var/www/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\n"
As you can see, it is 3.0.0.
When I try to run command in kernel system this
cd /var/www/deploy/build/project_to_be_deployed && mina deploy it fails because it tries to use ruby 3 instead of 2.6.5, if I try to switch using rbenv using rbenv local or changing value of RBENV_VERSION it shows me proper 2.6.5 but everyr command is executed under 3.0.0
Maybe I am explaining poorly. Every command is runned from ruby code, using system() call. On bash everything works fine! The problem is I think in the forking of bash or loading the environment during execution of command from ruby
I did a fresh install of Ruby 2.6.5 x86 on my Windows Server 2016 64-bit machine (previously had 64-bit 2.6.5 and some 2.4.5 version. Can't remember if it was 32/64 bit). I did NOT run the MSYS install at the end. I see the PATH has been updated to include ruby. When I type ruby in a command prompt nothing happens. I do not get a message saying ruby is unrecognized. It actually looks like ruby is going to open (I see mouse loading animation) in the command prompt but then immediately terminates. How do I fix this?
As requested here are the results of where ruby:
ruby
is not interactive interpreter, it is only used to run complete scripts like this:
ruby script.rb
Use
irb
for interactive programming. You also can run a script and then poke around inside it with
irb -r ./script.rb
Can someone help me out?
So I installed Ruby 2.4 on my PC via the RubyInstaller from https://rubyinstaller.org/downloads/. I have Windows 10.
I've used Ruby 2.2 and this 2.4 version seems very different.
When I installed it, it created an MSYS2.exe and it now opens a bash shell.
I've not used a bash shell in a very long time (14+ years). I can navigate fine in it. But I receive the following error message when I try to run a ruby file:
$ ruby r1.rb
bash: ruby: command not found
I'm not sure how to run a ruby script on the bash shell from MSYS. I have added the C:\Ruby24-x64\bin to my environment variables. But I still get the same message.
I'd appreciate some assistance if possible. Thanks.
I've been trying to install ruby dev kit and following the instruction on this page.
http://rubyonwindowsguides.github.io/book/ch02-04.html
My problem is that when I run rb.dk in the devkit directory, it quits before i am able to do anything (so i am not able to follow next steps).
I really appreciate all help.
run it in a cmd prompt as C:\Ruby\devkit>ruby dk.rb.
Running it by associating the CLI with the file causes the cmd prompt to close as soon as the ruby interpreter stops.