How to update ruby in windows
The easiest way for you might be to use RubyInstaller, which its version 2.0.0-p0 is now available for download as installers. Follow the link http://rubyinstaller.org/ for more information.
How to update Ruby 2.2.4 to 2.2..5
Because you used Rails Installer to get Ruby set up initially, you will need to download an updated version of RailsInstaller. Unfortunately, it's current 2.2 installer includes 2.2.4.
One suggestion would be to remove RailsInstaller and use RubyInstaller instead. Unfortunately, then you would also need to set up other tools, such as Git, a database, etc.
The other thing you could try is going to an older version of ruby_dep
, it appears that 1.3.1
would be suitable for you. This is dependent upon the rest of your project, since it's possible you need the current version of ruby_dep
.
How to update gems in Ruby for Windows?
First run (with administrator privileges):
gem update --system
Then run the update for activesupport.
I have that error one time, because i was behind a proxy, in that case, put:
gem update --http-proxy http://web.proxy.uri --system
Ruby: How to update to Ruby 2.1 in windows? (Installed 1.9.3 using Rails Installer)
Quickest way would be to uninstall the previous version of rails installer, and installing with the new version of rails installer.
See https://stackoverflow.com/a/18083733/429758 & How to update ruby in windows for more on the same topic.
How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?
Open your terminal and run
curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable
When this is complete, you need to restart your terminal for the rvm
command to work.
Now, run rvm list known
This shows the list of versions of the ruby.
Now, run rvm install ruby@latest
to get the latest ruby version.
If you type ruby -v
in the terminal, you should see ruby X.X.X
.
If it still shows you ruby 2.0.
, run rvm use ruby-X.X.X --default
.
Prerequisites for windows 10:
- C compiler. You can use http://www.mingw.org/
make
command available otherwise it will complain that "bash: make: command not found". You can install it by runningmingw-get install msys-make
- Add "C:\MinGW\msys\1.0\bin" and "C:\MinGW\bin" to your path enviroment variable
How to install ruby 2.4.0 in Windows 10
Windows 10 comes with a new feature called Windows Subsystem for Linux (WSL) that allows you to use Bash with the most common Linux tools included the ones you need to install a Ruby Manager Version.
For this tutorial we'll set up Ubuntu on Windows, Ruby 2.4.0, Rails 5.0.1 and PostgreSQL.
Installing Bash On Windows
First enable developer mode on your machine
https://www.youtube.com/watch?v=S6NvjvL3xaINext install Windows Subsystem for Linux
https://www.youtube.com/watch?v=g_5hxfFKDL8And restart your computer.
After the computer reboot open a Command Prompt (CMD) and type
> bash
You will see the next message
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms
Press "y" to continue: yPress "Y" to continue
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes….Bash will ask you for a user, please remember this user because bash will ask you every time you need root permissions in Bash. Also when you time your password you won’t see the keystrokes, it’s normal, only keep typing and press ENTER when you finish.
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms.wslusers
Enter new UNIX username:
Enter new UNIX password:And your Bash is ready when you see the CMD its in the
mnt/c/Users/your_username
directory.your_username@yourmachine:/mnt/c/Users/your_username$
Installing RVM and Ruby
In your bash copy this line:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
Then install gnup2
$ sudo apt-get install gnupg2
Remember your UNIX password because every time you saw a
sudo
in the command you will be asked for your password.
Install RVM
$ \curl -sSL https://get.rvm.io -o rvm.sh$ cat rvm.sh | bash -s stable
$ source ~/.rvm/scripts/rvmInstall Ruby
$ rvm install ruby-2.4.0
If you need to install other version of ruby run this same command like this
$ rvm install ruby-2.3.5
And select the ruby version you want to use
$ rvm --default use 2.3.5
To check if it works
$ ruby -v
Installing RubyOnRails
Install the Ruby’s package manager Bundler
$ gem install bundler
Add NodeJS
$ curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
$ sudo apt-get install -y nodejsInstall Rails
$ gem install rails
Installing PostgreSQL
Download PostgreSQL installer and follow the instructions of the installation
https://www.openscg.com/bigsql/postgresql/installers.jsp/The installer will ask you for a user and a password, also keep them in a safe place because you will use it to access to PostgreSQL command line and in
database.yml
in your ROR project.When the installation finish, return to bash and type the next command
$psql -p 5432 -h localhost -U your_postgresql_username
Bash will ask you the PostgreSQL password and if everything works you will have access to the Postgres shell prompt
psql (9.5.6, server 9.6.2)
WARNING: psql major version 9.5, server major version 9.6.
Some psql features might not work.
Type "help" for help.
postgres=#Type \q to exit the Postgres shell.
Running your Rails app
Open the project in your favorite editor and update the
database.yml
with the PostgreSQL username and password.development:
database: your_app_name_development
username: your_postgres_user
password: your_postgres_password
host: localhost
port: 5432
test:
database: your_app_name_test
username: your_postgres_user
password: your_postgres_password
host: localhost
port: 5432In Bash go to the directory where is your rails project, for example:
$ cd Projects/my_app
To learn more about Bash navigation visit
https://www.pluralsight.com/guides/beginner-linux-navigation-manual
Create your database
$ rake db:create
Run the rails server to make sure everything is working
$ rails s
And go to your browser and visit
$ localhost:3000
Every time you need a Bash, open a Command Prompt and type
>bash -l
For more detail of each of the commands in this tutorial, visit
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-and-set-up-a-local-programming-environment-on-windows-10
https://medium.com/@colinrubbert/installing-ruby-on-rails-in-windows-10-w-bash-postgresql-e48e55954fbf
Why is Ruby not updating after updating with Ruby Installer?
You need to update your PATH
environment variable, it is still pointing to the old installation. If I remember correctly, the installer does have a box to check off to set the PATH
variable. Only one installation at a time can be in your PATH
.
See this answer for a quick way to change the variable. It will follow the same syntax as the following.
Open cmd.exe
and type:
set PATH=%PATH%;C:\Ruby250\bin
Your installation location may be different, confirm before entering. You can also do it through the properties window of MyComputer
or whatever they call it now. I find the terminal to be simpler, as it take abouts 6 windows deep to change through the GUI.
Step By Step:
- Find the directory where ruby is installed to, usually
C:\Ruby250\bin
(version may vary) - Open a command prompt, terminal,
cmd.exe
, or whatever name you
prefer to call it. - Type
set PATH=%PATH%;C:\Ruby250\bin
(change folder name if yours
is different) - Press
Enter
button - In a new
cmd.exe
, typeruby -v
- Enjoy
ANOTHER EDIT
- Click on the "Start" button (probably bottom-left of your screen)
- Start typing the word "environment" until you see the option
Edit
appear
the system environment variables - Click on that
- A small window will open, towards the bottom left is a button that
readsEnvironment Variables
- Click on that button
- There will be two sections, one for the user (that is current account
only) and the other is the "system", which is the default and
system-wide variables - In each of these (just to be sure), highlight the line that has
"Path" for the name of the variable - Find the button under the list that you just clicked in that reads
Edit...
- Click on it
- Look through list, it is different for everyone, can't read it for
you. Find the one that it is the location of a Ruby installation,
mine readsC:\Ruby24\bin
because I am using Ruby 2.4.4 - YOU NEED TO MAKE SURE THAT THE FOLDER PATH IS WHERE YOU INSTALLED
RUBY. This cannot be done for you, only you know. It is by defaultC:\RUBY***\bin
, where the***
is your version number. You have to
open explorer and simply look. - If the variable is where is where Ruby 2.5 is installed, good, it
doesn't need changed, but look through the list to make sure there
are no other paths to other versions of Ruby. If there are, highlight
them and click the delete the button to remove. - Click
OK
on each window that you may have made an edit, notCancel
, and not X out the window. - To confirm it works, open a new command window, if one was already
open, the changes will not be updated in it.
Related Topics
What's the Best Option for Searching in Ruby on Rails
How to Make a Ruby String Safe for a Filesystem
How to Get the Line of Code That Triggers a Query
How to Spawn an Eventmachine "Inside" a Rails App
Multiple Sinatra Apps Using Rack-Mount
Subtract N Hours from a Datetime in Ruby
Replacing the 'Auto_Link' Method in Ruby on Rails 3.1
Overriding the == Operator in Ruby
Cannot Use Ruby-Debug19 with 1.9.3-P0
How to Set/Get Session Vars in a Rack App