Setup Ruby On Rails on
Windows 10

A guide to setting up a Ruby on Rails development environment

This guide is a work in progress as the new Bash on Ubuntu on Windows Linux Subsystem is in beta. There is a lot of functionality not implemented yet so you'll find that, while the basics might work, some of the more advanced and complex things won't.

This will take about 45 minutes.

We will be setting up a Ruby on Rails development environment on Windows 10.

The reason we're going to be using Bash on Ubuntu on Windows because it allows you to run Linux on your Windows machine. Most Ruby on Rails tutorials and dependencies work best on Linux, so this allows you to get the best of both worlds. A Windows machine for your day to day work, and a Linux subsystem for Ruby on Rails development.

This only works on 64-bit installations of Windows. This is also in beta, so this won't be nearly as robust as running a Linux virtual machine, but it can definitely do the basics well enough.

Bash on Ubuntu on Windows is the name for the Linux Subsystem that's in beta right now for Windows. It allows you to run Linux on Windows without having to run a VM.

Right now, this update is only available to those on the "Fast" option in the Windows Insider program. You'll want to join the Windows Insider program and set your Insider level to "Fast".

Here's how you can join the Windows Insider program.

The first step is to enable "Developer mode" in Windows. You can do this by opening up Settings and navigating to to Update & Security, then "For Developers". Click the "Developer mode" option to enable it.

Developer mode

Now we need to enable to Windows Subsystem for Linux. You can do this by opening Control Panel, going to Programs, and then clicking "Turn Windows Features On or Off". Looking for the "Windows Subsystem for Linux" option and check the box next to it.

Subsystem for linux

The earliest working version of this for me is Windows 10 release 14352. If Windows Subsystem for Linux doesn't show up in the list right away, you may need to make sure you're part of the Windows Insider program and set to the "Fast" level, update Windows, reboot, or wait a few days for the option to become enabled. I enabled Developer mode and had to wait two days or so before the option became available. I'm not sure how this feature propogates, but try a couple of these options and you should get it.

Once you've got this installed and after rebooting, we can start setting up Bash on Ubuntu on Windows.

Start by searching for "bash" in the start menu.


Next we'll follow the installation steps to get Bash on Ubuntu on Windows installed.

Installing bash

Once that's complete, you can open up the Start menu again and search for "Bash". This time it will have the Ubuntu logo.

Bash on ubuntu on windows

Now you've got a functional Ubuntu Linux installation running on your Windows machine!

Hello linux

From here we can follow the normal Ubuntu setup steps to install Ruby, Rails, and our database.

Choose the version of Ruby you want to install:

The first step is to install some dependencies for Ruby.

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm.

Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.

Installing with rbenv is a simple two step process. First you install rbenv, and then ruby-build:

git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.5.0
rbenv global 2.5.0
ruby -v

The installation for rvm is pretty simple:

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.5.0
rvm use 2.5.0 --default
ruby -v

Arguably the least useful Ruby setup for development is installing from source, but I thought I'd give you the steps anyways:

tar -xzvf ruby-2.5.0.tar.gz
cd ruby-2.5.0/
sudo make install
ruby -v

The last step is to install Bundler

gem install bundler

rbenv users need to run rbenv rehash after installing bundler.

We'll be using Git for our version control system so we're going to set it up to match our Github account. If you don't already have a Github account, make sure to register. It will come in handy for the future.

Replace my name and email address in the following steps with the ones you used for your Github account.

git config --global color.ui true
git config --global "YOUR NAME"
git config --global "[email protected]"
ssh-keygen -t rsa -b 4096 -C "[email protected]"

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/

Once you've done this, you can check and see if it worked:

ssh -T [email protected]

You should get a message like this:

Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.

Choose the version of Rails you want to install:

Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment.

To install NodeJS, we're going to add it using the official repository:

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs

And now, without further adieu:

gem install rails -v 5.1.4

If you're using rbenv, you'll need to run the following command to make the rails executable available:

rbenv rehash

Now that you've installed Rails, you can run the rails -v command to make sure you have everything installed correctly:

rails -v
# Rails 5.1.4

If you get a different result for some reason, it means your environment may not be setup properly.

Rails ships with sqlite3 as the default database. Chances are you won't want to use it because it's stored as a simple file on disk. You'll probably want something more robust like MySQL or PostgreSQL.

There is a lot of documentation on both, so you can just pick one that seems like you'll be more comfortable with. If you're coming from PHP, you may already be familiar with MySQL. If you're new to databases, I'd suggest skipping to setting up PostgreSQL.

You can install MySQL server and client from the packages in the Ubuntu repository. As part of the installation process, you'll set the password for the root user. This information will go into your Rails app's database.yml file in the future.

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

Installing the libmysqlclient-dev gives you the necessary files to compile the mysql2 gem which is what Rails will use to connect to MySQL when you setup your Rails app.

When you're finished, you can skip to the Final Steps.

The easiest way to setup PostgreSQL is to install it on Windows using one of the Windows installers. You'll be able to run it in Windows and connect to it through Linux.

Download PostgreSQL for Windows and install it.

Pay attention to the username and password you setup during installation of Postgres as you will use this to configure your Rails applications later to login to Postgres when your Rails app runs.

The best place to develop Rails apps on the Windows Subsystem for Linux is to navigate to `/mnt/c`. This is actually the C: drive on Windows and it lets you use Sublime, Atom, VS Code, etc on Windows to edit your Rails application.

When you create a new Rails app, you might run into the following error: parent directory is world writable but not sticky.

If you run into this issue, you can run chmod +t -R ~/.bundle and that should fix the permissions errors and let you finish the bundle install for your Rails app.

And now for the moment of truth. Let's create your first Rails application:

# Navigate to the C: drive on Windows. Do this every time you open the Linux console.
cd /mnt/c

# Create a code directory at C:\code for your Rails apps to live (You only need to do this once)
mkdir -p code

#### If you want to use Postgres
# Note that this will expect a postgres user with the same username
# as your app, you may need to edit config/database.yml to match the
# user you created earlier
rails new myapp -d postgresql

#### or if you want to use SQLite (not recommended)
# rails new myapp

#### Or if you want to use MySQL
# rails new myapp -d mysql

# Then, move into the application directory
cd myapp

# If you setup MySQL or Postgres with a username/password, modify the
# config/database.yml file to contain the username/password that you specified

# Create the database
rake db:create

rails server

You can now visit http://localhost:3000 to view your new website!

Now that you've got your machine setup, it's time to start building some Rails applications!

If you received an error that said Access denied for user 'root'@'localhost' (using password: NO) then you need to update your config/database.yml file to match the database username and password.

To edit your code in Windows: open up Sublime, Atom, VS Code, or whatever editor your prefer and point them to your folders in C:\code and you'll be able to safely edit your Rails apps in Windows and run them in Linux!

That's it! Let us know in the comments below if you run into any issues or have any other protips to share!.


Mike Hart on


I got all the way through this so thanks for the walk through! I run "rails server -b" and the server boots fine but when I go to localhost:3000 in the browser, the browser icon spins but the server does not respond. Has anyone seen this before?

Mike Hart on

I've worked it out now. It seems that thin was the problem. I switched to webrick and the app now runs perfectly. I don't exactly no what the problem was with thin but this solution works for now!

Abhimanyu Aryan (60 XP) on

So cool. I have been waiting for you to write this :)

Konrad Krawczuk (10 XP) on

This is great tut- based on it I installed rails 5 and ruby 2.3.1. created new test app and after rails -s I have something like this: => Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
/root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/watcher.rb:74:in `initialize': Invalid argument - Failed to watch "/root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/locale": the given event mask contains no legal events; or fd is not an inotify file descriptor. (Errno::EINVAL)
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:190:in `new'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:190:in `watch'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:204:in `watch'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:32:in `_configure'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:45:in `block in configure'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `each'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `configure'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:63:in `start'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/backend.rb:28:in `start'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/listener.rb:67:in `block in <class:listener>'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `instance_eval'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `call'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/fsm.rb:57:in `transition'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/listen-3.0.8/lib/listen/listener.rb:90:in `start'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/evented_file_update_checker.rb:90:in `boot!'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/evented_file_update_checker.rb:61:in `initialize'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:59:in `new'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:59:in `initialize_i18n'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:15:in `block in <class:railtie>'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/application/finisher.rb:65:in `block in <module:finisher>'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `run'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /root/.rbenv/versions/2.3.1/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/application.rb:352:in `initialize!'
from /root/myapp/config/environment.rb:5:in `<top (required)="">'
from /root/myapp/ `require_relative'
from /root/myapp/ `block in <main>'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
from /root/myapp/ `new'
from /root/myapp/ `<main>'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:59:in `app'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:124:in `log_to_stdout'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:77:in `start'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)="">'
from /root/myapp/bin/rails:9:in `require'
from /root/myapp/bin/rails:9:in `<top (required)="">'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)="">'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
from /root/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)="">'
from /root/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /root/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /root/myapp/bin/spring:13:in `<top (required)="">'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Any ideas what should I do ?

abdulhadad on

According to this site[1] you can omment out "config.file_watcher = ActiveSupport::EventedFileUpdateChecker" in this file, config/environments/development.rb


BashCoder on

The main issue here is that inotify has been completely broken in WSL. So even if you disable listeners, tools like Guard won't work. Insiders are soon getting a partial fix, whereby files changed within WSL itself can be watched without errors.

Here's the test. First install inotify-tools, which give you some command line programs to monitor files:

$ sudo apt-get install inotify-tools

Then attempt to watch any file from the command line:

$ touch testfile.txt && inotifywatch testfile.txt
Establishing watches...
Failed to watch ./testfile.txt: Invalid argument

Note that's the same error that rb-inotify reports above.

Github issues:

mike927 on

I get the error like : `sudo: setresuid() [1000, 106, 1000] -> [-1, 0, -1]: Operation not permitted` when I try to create new postgres user. Is it going to be fix in the nearest feature?

Abhinav Tripathi on

why does this blog have no support?
people are facing multiple issues!

Kevin Méndez on

Hi, friend! You can install postgres in windows. To connect the app you only need a port of the database (I had the same issue at the beginin).

Stefan Cardenas on

I'm getting the same error and can't figure out how to get around it. I've tried uninstalling and reinstalling Postgresql to no avail. Any thoughts?

Adrianne M (10 XP) on

How were you able to get the terminal to let you copy the SSH key so that you could paste it into GitHub? Copy and paste is not working for me using shortcuts or the mouse, and there is no menu that I can see.

anithri on

RIght click on the Ubuntu icon, go to properties and check the boxes under Edit Options and text selection

timtilberg on

I would just suggest taking a look at -- This tool is a terminal lifesaver for me on Windows. It is highly configurable. By default, it adds git and some linux tools to cmd, the default shell it uses, but also allows you to use any shell (MING64, Git Bash, PowerShell, the new Bash/Ubuntu for Windows).

Today I tried getting on with the default Bash for Windows which uses the older cmd terminal, but I went bananas. Cmder gives you the text tools you need!

Łukasz Fuszara on

I run Rubinius on Windows 10 Bash.

Brian Arpaio on

When I run "rails new testApp -d mysql" I get back
"Errno::ENOMEM: Cannot allocate memory - sudo -p "

Your user account isn't allowed to install to the system Rubygems."

Anyone have any ideas where I went wrong?

Brian Arpaio on

Fixed it - had to do a fresh install of everything from outside of the firewall at my office.

Tried re-installing and now the error I get is
"Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /home/barp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/debug_inspector-0.0.2/ext/debug_inspector
/home/barp/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160805-549-tt92si.rb extconf.rb
Cannot allocate memory - /home/barp/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160805-549-tt92si.rb extconf.rb 2>&1"

travel1387 on

I received an error "There was an error while trying to load the gem "uglifier". Gem Load Error is: Could not find a JavaScript runtime." Any ideas?

Kai Dorschner on

Install node.js in the Linux subsystem maybe?

Paulo de Tarso on

After I close the terminal I lost all the settings that I had installed following this tutorial. I will try install it again but I fear that the same happen again. What should I do to prevent it?

Paulo de Tarso on

In fact, some commands stoped working since I closed the bash: rails new, rake test, bundle etc.

J. Pablo Fernández on

You probably need to reselect the ruby with rbenv or rvm.

strangebiscuit on

I'm able to go through this whole tutorial for Windows 10 bash and get everything listed here working (using rvm currently). I get through all the final steps without error, got a working server, etc...

But I'm trying to follow a basic "hello world" tutorial ( found here: ) and when I try "rails generate controller pages" I get: "Error: Command 'rails' not recognized" as well as an info section on "Usage: spring COMMAND [ARGS]" and "Usage: rails COMMAND [ARGS]"

I'm confused as to how it could possibly say 'rails' is not recognized. I can do "rails -v", I can do "rails new", I can do "rails server", etc...

Anyone have any advice? I've tried this like 6 times now (resetting my entire linux subsystem after each failed try) using both rvm and rbenv and I end up stuck at this point every time. Any pointers as to where I'm going wrong would be greatly appreciated...thanks!

timtilberg on

I was having this same issue and abandoned my attempt. If someone understands what's at hand here, that would be great.

Chris Oliver (159,850 XP) on

Not entirely sure on that one. Have you guys tried using rbenv instead?

timtilberg on

For me, that was with several attempts on different machines using my preferred rbenv -- I'm going to try RVM and report back.

Chris Oliver (159,850 XP) on

Curious to hear what you find out. I didn't have any issues personally, but only tested rbenv. Now my Windows 10 install is borked and I haven't had time to fix it so it boots again.

timtilberg on

Well, I've tossed and reinstalled WSL from scratch, and tried the RVM install instead. I found that I needed to do `bash --login` to reference my profile (and load rvm) if I left the terminal -- so it might be a good idea to reference that -- apparently the default session is not interactive.

Anyway -- I did not encounter the sticky directory issues while using RVM, but I am still having the same issue as above running generators. I've tried both `rails g scaffold hotdogs good tasty` and `bundle exec rails g scaffold hotdogs good tasty` to no avail.

[email protected]:~/hotdogs$ uname -a && rvm -v && ruby -v && rails -v
Linux TIMDESKTOP 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux
rvm 1.27.0 (latest) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> []
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
Rails 4.2.6
[email protected]:~/hotdogs$ rails generate scaffold dogs good tasty
Version: 1.7.2

Usage: spring COMMAND [ARGS]

Commands for spring itself:

binstub Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.
help Print available commands.
server Explicitly start a Spring server in the foreground
status Show current status.
stop Stop all spring processes for this project.

Commands for your application:

rails Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, test.
rake Runs the rake command
Error: Command 'rails' not recognized
Usage: rails COMMAND [ARGS]

The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
new Create a new Rails application. "rails new my_app" creates a
new application called MyApp in "./my_app"

In addition to those, there are:
destroy Undo code generated with "generate" (short-cut alias: "d")
plugin new Generates skeleton for developing a Rails plugin
runner Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.

timtilberg on

I just wanted to add that using the RVM install, knowing to use `bash --login` when I hop in, and ignoring the usage of any commands that utilize spring (generators, console, rake test :( ), seems to be working relatively fluidly (including the majority of rake tasks).

Obviously those are some big issues, but at least I can clone my working project down and run it currently. My last few attempts with RailsInstaller have been horribly unproductive.

Chris Oliver (159,850 XP) on

Makes sense with the login shell. I wonder why they changed that, because I don't think that was how it used to be. Going to frustrate a lot of people if they keep that as the default.

timtilberg on

Got it!

This guy has a solution

bundle config --delete bin
rake rails:update:bin
git add bin

I've successfully tested it using WSL/Bash on Win10, with the instructions posted above using the RVM install, after running `bash --login` to ensure interactive shell.

strangebiscuit on

I've tried numerous times using both the rvm and rbenv route and end up with the exact same issue as described above every time. I've reset the entire linux subsystem between each attempt.

Chris Oliver (159,850 XP) on

Seems they've been making some changes to it, one of those being it's not a login shell, so you'll have to do "bash --login" for now. Still other outstanding issues. Maybe they'll get some of them fixed soon.

timtilberg on

I posted this in the long chain of comments that follows this thread, I thought I'd add it back up here for you and future folks too.

This guy has a solution

bundle config --delete bin
rake rails:update:bin
git add bin

I've successfully tested it using WSL/Bash on Win10, with the instructions posted above using the RVM install, after running `bash --login` to ensure interactive shell.

I hope this helps you out!

Chris Oliver (159,850 XP) on

Good to hear! This has to be frustrating.

Kirkos Gent (30 XP) on

I had the same problem and followed the fix above. The "rails generate controller welcome homepage" finally worked only to create the "app/controllers/welcome_controller.rb" and the route "get 'welcome/homepage'. Then produces the following error "/home/Username/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/actions/inject_into_file.rb:98:in `binread': Input/output error @ rb_sysopen - /home/Username/MyProject/config/routes.rb (Errno::EIO)" and following several .rbenv file names with error lines. Any ideas?

timtilberg on

I saw your post on SO but don't have enough rep to comment there, so I'll comment here.

You mention not seeing routes.rb in bash, but seeing the file in Windows, and then proceeding to copy stuff around.

The file path you mention your project to be in is a straight up linux folder (/home/User1/stuff) as opposed to a shared, mounted directory in the Windows system. With this said, I've read that interacting with files on that side (burried in appdata or wherever) of the system from Windows causes problems because of the differences in how files are handled between the systems. So, as you mention in SO, trying to copy those files from Windows will likely lead to difficulties.

I've had success with my projects living in the Windows mount area -- for example:

cd /mnt/C/Users/Tim/Desktop
rails new hello_world

With the files living there, it is easy to manipulate with Windows or Linux then without causing corruption (the worst of it seems to be line ending issues, which any proper text editor can deal with).

In addition, I was using rvm, instead of rbenv.

Without knowing too much more, I'd give generic recommendations akin to "reboot it and see what happens":

- run rbenv rehash
- run bundle install
- run chmod +t -R ~/.bundle
- consider running chown -R user:user /home/user
- cd /mnt/c/Users/User/Desktop && rails new hotdogs && cd hotdogs --- and try creating a controller from there -- pay attention to what happens to the actual output

Hope you find something -- I went through a bit of hell when I tried updating ruby recently, before WSL. I had a perfectly running Ruby 2.2.0 on my system with Rails -- tried upgrading, and went through 3 weeks of frustration in trying to get a working ruby again. The method I posted above has been working really great for me finally, but I don't dare mess with it again -- it's so damned fragile!

Kirkos Gent (30 XP) on

Thank very much you for the recommendations. I created a new bash user to install rvm there and follow your recommendations (do you think is OK or I should reinstall the whole subsystem and use rvm this time?). I'll let you know whether it is worked for me too.

Kirkos Gent (30 XP) on

Well, finally, the RVM installation with the fix above works fine, like you said! (I found no way to make rbenv installation operational). Thanks a lot!

timtilberg on

Hey @excid3:disqus -- You might want to consider noting some of this stuff in the Windows specific guide, unless you are in fact seeing people successfully using rbenv. Right now the guide says rbenv is the recommended way, but I haven't been able to get it to work on WSL without issues. If you know how, that information would also be appreciated :)

Chris Oliver (159,850 XP) on

I used rbenv just fine when I initially set things up. My Windows 10 install got corrupted so I need to reinstall it and try this again sometime to see how things have changed.

Anthony Coffey on

THIS IS AMAZING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I love you <3

JFGrissom on

I agree with Anthony on this. I have the best of both worlds (solid windows gaming on a ridiculously fast machine and still have an ubuntu bash shell).

This is really perfect Chris. You're awesome.

radical_primate on

Excellent!! Thanks so much for this. Up and running without a hitch after first updating to Windows 10 Anniversary. You don't need to be an Insider to update now.

I hope WSL is the real deal...I've had several fits and starts trying to get going with rails on a windows machine.

Suggestion for newbies: rather than create myapp in your linux directory, switch to your windows directory, then create myapp there.

At that point you'll have ready access to work on the myapp files via your IDE

Thus, for final step, type this at the prompt $: cd /mnt/c/Users/you

Then in this director type $: rails new myapp

IlIlIl on

Got things rolling smoothly with this article. Not sure if anyone else had this issue but ruby took a really long time to install. I thought it was hanging but figured I'd give it a chance and left it running when I went to bed. In the morning it was done so slightly longer than 45 minutes for me!

Chris Oliver (159,850 XP) on

It definitely can take a while sometimes. Depends on how powerful your computer is and stuff.The good news is you rarely need to do it so once it's done, you will be set for quite a while!

Zaur on

why hours and not minutes?, does not seem like the download was much.

Chris Oliver (159,850 XP) on

Because compiling Ruby takes a lot of CPU power.

Dale D. Smith on

I installed everything. Started the server. Went to the webpage and I got the error:
Cannot load `Rails.application.database_configuration`: No such file or directory @ rb_sysopen - /home/dale/myapp/config/database.yml

Also I tried a cat config/database.yml and received a no file or directory error.

I look in the directory and the file is there.

Frustrating. Can't find a solution. Anyone?

Chris Oliver (159,850 XP) on

Hey Dale, you'll probably need to create that file if your Rails app doesn't have one. Some details on that file: http://edgeguides.rubyonrai...

Dale D. Smith on

I setup a new app and now I get the following message. I know something isn't configured correctly, but I don't know how to determine what it is.

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Dale D. Smith on

After many times removing everything and starting over I finally resolved the issue. Or should I say this article fixed the problem. I was missing the /var/run/mysqld/mysqld.sock file. It is fixed and I am finally up and running with Rails on Bash on Ubuntu on Windows 10!

Peter Truchan on

Thank you! I would suggest to add to postgresql installation quide, that it is possible to make it running by installing postgres directly on windows ( - prefferably version 9.3.

Another issue I had is with Thin rails server. You have to use webrick by setting enviroment variable: `export RACK_HANDLER=webrick` and then run `rails s`

PS: I am going to try to develop our application on windows with this setup, I will post my experience then. Our application is for chess players and tournament organisers -

ralphie02 on

Did you configure anything after the postgresql installation? I tried to follow the instruction here: but it didn't work for me. Do you have any tips/comments that could help? Thanks

pinkham on

BTW.. I did a standard postgresql install on windows and didn't do anything special in the linux side.. my rails app in rails can talk to the postgresql server running in windows.. localhost points to the same place linux and windows..

ralphie02 on

Thanks for letting me know! I'll go and try this again in the future. Maybe I just messed something up

JK Apps on

Hi, I have mysql installed on windows. Do I need to install it separately on Linux Subsystem? Thanks

Kai Dorschner on

Unfortunately as of now, when running "sudo -u" there is a bug in the Windows Bash which states: `sudo: setresuid() [1000, 1000, 1000] -> [-1, 0, -1]: Operation not permitted`

Official bug here:
Of course you can work around that by using `sudo su USER`.

Otherwise a really nice tutorial with good hints (especially the `chmod +t -R ~/.bundle` one)! Million thanks!

Alex Leung on

I seem to have trouble sending http requests from my rails server on my windows 10 ubuntu subsystem, whereas people working on their OSX or normal linux have no such problem even with the same code. I keep getting a Net::OpenTimeout (expiration expired) exception no matter what type of http request I do. Has anyone experienced this as well and does anyone know why this might be happening?

ralphie02 on

@petertruchan:disqus How exactly did you get the postgresql installation to work? I followed the instruction i found here: but it didn't work. Any tips/comments would be appreciated. Thanks

Tecnologia Senatur on

Hi!. I have a problem running a rails server. It's seems that a Thin Server is up and running, but not listening on port 3000

This picture will show you my situation. Please help me!.

J. Pablo Fernández on

Known issue:

Gayatri T (20 XP) on

hey .. did all the things till the final step /
i had some problem so closed the bash screen and turned on again
now when i type ruby -v .. its says it to install same goes for rails everything

so .. far i dnwld everythng is gone ah ???

i dont understand help me

it took nearly 4 hrs fr me to reach final step

Chris Oliver (159,850 XP) on

It's likely that everything is installed but your terminal didn't automatically load rbenv again. Double check and make sure that you followed all the rbenv lines correctly to echo the lines into your .bashrc file.

Gayatri T (20 XP) on

i used RVM to install

is that a problem ????

Alexandros Bulko on

I had the same problem.... this worked for me:
/bin/bash --login

after that I could use ruby -v, rails -v, even rails server
hope it helps :)
BTW I also used rvm

Alexandros Bulko on

So, today I found something better.... Open up the launcher of the bash and go to the properties.... change the target to "C:\Windows\System32\bash.exe ~ -c "/bin/bash --login"... after this you do not have to use the solution from previous comment every time you launch it.... This works automatically... It's based on the fact that normally you launch a non-login session, however, with these settings you, on the other hand, run a login session..... If you want to know more, read these threads and

Chris Oliver (159,850 XP) on

Hopefully that default changes in Windows as that's unexpected behavior from anyone who is used to opening bash with a login shell automatically on any Linux install.

Delph Soft on

great article , someone know how to install solidus ecommerce on w10 ussing bash ubuntu? thks

mkrsnik on

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/home/rakis/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161113-24750-68ud34.rb
Cannot allocate memory - /home/rakis/.rbenv/versions/2.3.1/bin/ruby -r
./siteconf20161113-24750-68ud34.rb extconf.rb 2>&1

Gem files will remain installed in
/home/rakis/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/byebug-9.0.6 for
Results logged to

An error occurred while installing byebug (9.0.6), and Bundler cannot
Make sure that `gem install byebug -v '9.0.6'` succeeds before bundling.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`

Peter Wake on

Brilliant - all worked v smoothly, like someone else said installing ruby 2.3.1 took ages. You may also need to install rmagick - to do this type sudo apt-get install libmagickwand-dev imagemagick

Beluan Fil Joseph Qu on

I got the problem, i'm following your tutorial, but this result after running rails new myapp -d mysql

There was an error while trying to write to
It is likely that you need to grant write permissions for that path.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`

Shawn Luo on

so how do we find the root directory where all the created apps are located?

Brian Gilbank on

It will be here: "C:\Users\Your Name\AppData\Local\lxss" to access your projects you will navigate to: "C:\Users\Your Name\AppData\Local\lxss\home\then your new Ubuntu username"

J. Pablo Fernández on

Any ideas how to access that Ruby binary from Windows? For example, how do I use it as the RubyMine Ruby.

J. Pablo Fernández on

Serving static files with webrick inside WSL seems to be as slow as it was on Windows. Have anybody experience this? any solutions?

dan setengahmanusia on

please explain to me, i still don't understand, why we don't install rails just using railsinstaller, or some simple easy installer else,,

Kevin Tan on

Rails dev environment is not native on Windows, which is why you have to go through all the hassle.

Kevin Tan on

I believe this guy actually reuses some other people's article and copy pasted.After installing ruby-build, when you do an rbenv install a specific version, Bash on Windows cannot create directories for installing the ruby version.

Chris Oliver (159,850 XP) on

Nope, wrote it myself, but things are constantly changing with Bash on Windows so these instructions break often.

Kevin Tan on

The horror. I might as well Virtualbox the Rails environment and just work from there instead then. Thanks anyways.

Chris Oliver (159,850 XP) on

Go for it. Like it says at the top of the post, this is for documenting it for Bash on Windows, not other approaches like VirtualBox.

Andrew on

After installing everything correctly, I received a "This site can't be reached" error for localhost:3000

Any suggestions?

Slava Titorovich on

© If you're using Windows Subsystem for Linux then there are currently some limitations on file system notifications that mean you should disable the spring and listen gems which you can do by running rails new blog --skip-spring --skip-listen.

Momus on

I know this is a bit of an older post, but it is one of the few places where someone is doing, more or less, what I'm trying to do. My question is, has anyone successfully done this with jruby? I have tried installing jruby 9000 in my home directory, in the multi-user setup (usr/bin/jruby which are symlinks pointing to /usr/lib/jruby/bin), and using RVM in the home directory. In all cases I get to the point where jruby is installed and seems to run properly, but the gem command simply doesn't work. When I try to run "gem install rails" or "gem install bundler" or "jruby -S gem install..." I get "Unable to download data from - timed out"

Abhimanyu Aryan (60 XP) on

is it possible to use sublime text somehow? Just wondering

Oluwole Oyekanmi on

Thanks for this.. It was quite helpful.

Dmitrii Evdokimov on

As for now this Bash is open for every PC with 64-bit Windows 10 Anniversary Update build 14393 (1607) or later -
So I install Ruby 2.4.1 from sources (and run Jekyll 3.4.3).

Ashwin on

Incase you're not able to do rake db:migrate with pgsql try this .

I installed pgsql on local windows and not on ubuntu bash
Then did the following:
Go to you config/environments/development.rb and comment out The Line config.file_watcher = ActiveSupport::EventedFileUpdateChecker,
After this run - rails s or rake db:migrate.

This worked for me and is pretty fast too.
Earlier I was using Vagrant (VM) and this (Ubuntu on bash) is faster than vagrant method,
Just my opinion, Hope it helps :)

Brian Gilbank on

What version of postgres did you install on windows?

Ashwin on

pgsql - 9.6 and rvm 2.4.
Initially I installed pgsql on ubuntu bash, but it didn't work, some error(don't remember it), then i read somewhere that we need to install on windows, so installed on windows and in db.yml added host as localhost.

Brian Gilbank on

Doesn't work with rbenv unfortunately. The pg gem won't install: fatal error: libpq-fe.h: No such file. If I run sudo apt-get install libpq-dev it can no longer find the gem file for some reason.

Brian Gilbank on

Actually got it working! Woohoo...

Alix Bear Kearney on

It looks like this does not work currently if you've been upgraded to xenial. Specifically, ruby does not appear to install correctly if you close the bash session, and you have to rerun the rvm script every time, in addition to not being able to install the rails gem at all.

Jonatan Jansson on

so go for rbenv?

Chris Habgood (40 XP) on

When going to locahost:3000 in the browser I get, json response as it it a api:

{"status":500,"error":"Internal Server Error","exception":"#\u003cRuntimeError: Cannot load `Rails.application.database_configuration`:\nCould not load database configuration. No such file - [\"config/database.yml\"]\u003e

Jen Hoo on

I have one problem on install postgresql on create user.
here is command:
[email protected]:~$ sudo -u postgres createuser malin -s
output: sudo: unable to resolve host XMAN
output: sudo: setresuid() [1000, 106, 1000] -> [-1, 0, -1]: Operation not permitted
how can I fixed it? Thank you.

Flo Slv on

can you do a tutorial to explain how it's possible to configure rubymine to edit a project? (project in ubuntu /home/User). I would like to use Rubymine i have install on windows to edit code in ubuntu subsysteme.

Thanks a lot!

shajinvk on

did you get the answer for this?

Alberto Trivero (30 XP) on

Chris it would be interesting to update the tutorial for Windows 10 Creators Update considering the many new updates and improvements the Windows Subsystem for Linux has received! ;) https://blogs.msdn.microsof...

Chris Oliver (159,850 XP) on

I will try doing that! I've gotta get my Windows 10 install back working again. :S

Alberto Trivero (30 XP) on

Chris you should add explicitly which version of Windows 10 (1511, 1607, 1703, ecc) this guide curretly refers to.
Anyway, news: Ubuntu finally on the Windows Store:

james chalmers on

My install works fine until 'gem install bundler' when I get this error:'/home/james/.rbenv/versions/2.4.0/bin/ruby: symbol lookup error: /home/james/.rbenv/versions/2.4.0/lib/ruby/2.4.0/x86_64-linux/ undefined symbol: parse_numeric_port'.
I'd appreciate any help as I really want to get WSL to work.

OnionBomb on

rvm works

Luis on


Thanks for the tutorial. It really helped me to get my basic setup up and running.
Thou I did have to fiddle around to get a few things working.
I should note that 5/14/17 I was not able to do

sudo -u postgres createuser YOURUSER -s

instead I had to use

sudo sudo -iu postgres createuser YOURUSER -s

due to -u not working at the time on WSL. Also I had to start the postgresql service before creating the user with

sudo service postgresql start

Hope this comments help people trying to install it later.

Thanks again for all your help and to all the RoR community, I just spent the last few days until I had my successful attempt at installing everything I wanted on WSL (yeah there were 4, I am now familiar with lxrun.exe /uninstall /full and lxrun.exe /install to reset the entire linux subsystem :P).

I would like to see added to the tutorial some information on installing MongoDB. For the moment I will just leave the link to the official tutorial small comment though there are problems starting mongodb as a service so for now the only way I have found is to use sudo mongod. Also, remember to run mkdir /data/db before starting the database (that last bit is required but it is not included in the official tutorial from mongo).

JimboSliceOG on

The source on my machine does not have the same path ~/.rvm/scripts/rvm

Mine is @: /usr/local/rvm/scripts/rvm

Also, The source is not persisting after exiting the terminal. And finally, it's failing when I try to start the rails server.

kream on

edit: got it working in the end, lots of patience required :)

Hello, thanks for the tutorial, however, I'm just trying to install rbenv and it has already taken 1 hour of waiting, it seems it is stuck on 'installing ruby-2.4.0...'. Should I just cancel and start afresh with rvm?

Zaur on

what did you do? I have same issue. Another comment mentioned he left it over night and was ready in the morning. It is crazy it takes this long. Cant imagine ruby being a huge program.

Zaur on

I am on a haswell cpu i5, 2 cores 4 threads. CPU and HD have been sitting at 1-2% now for about 24 hours. Not feeling like this will improve anytime.

Francisco Javier Vallés Johnso on

I just want to share how I was able to install postgresql 9.5.
First, after running "sudo apt-get install postgresql-common postgresql libpq-dev" I got the error:

" xenial-updates/main amd64 postgresql-client-9.5 amd64 9.5.7-0ubuntu0.16.04 Hash Sum mismatch"

So, as the console sugested, I executed it again adding "--fix-missing" and it worked.

Next, running "sudo sudo -u postgres createuser username -s" throwed the error:

"psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?"

which I solved by running "sudo pg_ctlcluster 9.5 main start".

Finally, trying to run "rails db:create" I got the error:

"new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)"

The solution for this was running:
- sudo sudo -u postgres psql
- UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
- DROP DATABASE template1;
- UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
- \c template1

I found all the above solutions searching in Google, but I don't remember the links.

Hope it helps someone and saves them some time.

JK Apps on

I have mysql installed on windows. Do I need to install it separately on Linux Subsystem?

Zaur on

How old is this guide? I ask because, as of 6/22/2017 msdn quotes:
"Languages: Javascript/node.js, Ruby, Python, C/C++, C# & F#, Rust, Go, etc.
Services: sshd, MySQL, Apache, lighttpd,"

Suggesting that ruby should have full support now?

Nik Rolls on

Thanks for the tutorial!

Just a note, it's "without further ado", not "without further adieu" 😉

francesco Esposito on

ruby-build: definition not found: 2.4.0 ??? help me plz

James Lucas Word on

I get this error anytime i start the rails server or type rails -v

/home/word/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.3/lib/rails/app_loader.rb:40: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
Rails 5.1.3

Joseph on

Great post. The install went fine, including the MySQL server installation, but when I try to connect to the MySQL server, I get the message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

I uninstalled it (sudo apt-get remove mysql-server) and re-installed. Same error message

If I try to re-install, I get the message that the MySQL server is already installed and is the latest version. Any ideas?

Joseph on

The install process, despite having asked me for the root password, etc., did not automatically start the MySQL server, so the solution is simple: sudo service mysql start

YanggonKim (610 XP) on

i got a q. now i am o [email protected] does this mean i am on a vertual & so i can not get actual folders and files?

Yuri de Sales Almeida on

Is it possible to share folders like vagrant?

Praful on

I get following error. I followed everything as mentioned in the article.
Looks like mysql db is not created.
Missed any step?

[email protected]:~/myapp$ rake db:create
#<mysql2::error: can't="" connect="" to="" local="" mysql="" server="" through="" socket="" '="" var="" run="" mysqld="" mysqld.sock'="" (2)="">
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>"******", "host"=>"localhost", "database"=>"myapp_development"}, {:charset=>"utf8"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'myapp_development'
#<mysql2::error: can't="" connect="" to="" local="" mysql="" server="" through="" socket="" '="" var="" run="" mysqld="" mysqld.sock'="" (2)="">
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>"*****", "host"=>"localhost", "database"=>"myapp_test"}, {:charset=>"utf8"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'myapp_test'
[email protected]:~/myapp$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[email protected]:~/myapp$

jscix on

Not sure if you ever got it working, and I don't have a solution really, but here are some thing's I would check.

Make sure the MySQL server is actually running. If so:

Get a visual MySQL Editor, there's alot of them, make sure your database encoding is UTF8, if it's not change it. The Visual Editor just makes it easier to check thing's out. It's a bit more simple than throwing commands into a console.

Check your Firewall, and make sure it's allowing connections on the MySQL servers port/s.

Make sure you have the correct permissions/privileges, both file system permissions, and privileges to access the MySQL service. For example MySQL may have been installed with only root, or admin access allowed. try opening the bash terminal as administrator, if that doesn't work try using sudo prefixed before commands (with, and then without admin privileges on the bash process.)

Sorry I couldn't give you a concrete solution, hope you get it working.

Anthony Muo on

how to open Sublime, and point them to your folders in C:\code

Max Goncharov on

It's very sloooow. Did anybody get this issue with all Rails/Rake commands?

jibbius on

Good post.

I also needed to run the following, prior to installing ruby:
sudo apt-get install -y gcc libssl-dev libreadline-dev zlib1g-dev make

james chalmers on

I installed ruby and rails correctly, but when I run my new rails app, my browser cannot connect. I must have missed something obvious somewhere. Has anyone else had this problem?

Gustavo Border on

Nothing wrong! Just had to start the MySQL service: "sudo service mysql start"

Jay Killeen (1,570 XP) on

Is there anything wrong with just running `sudo apt install rbenv` instead of the shell script? I was having issues with the script. Only the plugins folder was cloned...

Baraa Hatem on

Doesn't work with me.
rails aborted!
Don't know how to build task 'v' (see --tasks)
/home/Emad/myapp/bin/rails:9:in `require'
/home/Emad/myapp/bin/rails:9:in `<top (required)="">'
/home/Emad/myapp/bin/spring:15:in `<top (required)="">'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)

wadswob on

Just wanted to let you know that I just got this up and running! Thankfully I didn't have any issues. Thank you to whoever for putting this together! Great job!!!!

Login or create an account to join the conversation.