[Ruby] Build a development environment with Ruby on Rails breakpoints on Windows

2 minute read

Build a development environment where breakpoints of Ruby on Rails work on Windows

Development environment

  • Windows 10 64bit Ver.10.0.18362
  • Visual Studio Code Ver.1.46.0
  • ruby Ver.2.6.6
  • Rails Ver.

Install Ruby

Install Ruby+Devkit

Download and install Ruby+Devkit for Windows. Note that if you change the default installation path, some gems that will be installed after this need to be changed separately.

install required gems

Operate from the terminal of Visual Studio Code. The terminal is opened at the bottom of the screen by selecting “New Terminal” from “Terminal” in the menu.

gem install rubocop
gem install ruby-debug-ide
gem install debase
gem install rcodetools
gem install ruby-lint
gem install reek
gem install faster
gem install debride

Visual Studio Code settings

Add extension

Install “Ruby” from the extension function of Visual Studio Code. ruby.PNG

Edit ###setting.json Go to “File”->”User Settings”-“Settings” from the menu, and search for “ruby”. Click “Edit with setting.json” and edit setting.json as follows.


    "ruby.codeCompletion": "rcodetools",
    "ruby.format": "rubocop",
    "ruby.lint": {
        "reek": true,
        "rubocop": true,
        "ruby": true,
        "fasterer": true,
        "debride": true,
        "ruby-lint": true
    "ruby.intellisense": "rubyLocate",
    "ruby.locate": {
        "exclude": "{**/@(test|spec|tmp|.*),**/@(test|spec|tmp|.*)/**,**/*_spec.rb}",
        "include": "**/*.rb"

Editing ###launch.json


    "version": "0.2.0",
    "configurations": [
            "name": "Debug Lical File",
            "type": "Ruby",
            "request": "launch",
            "program": "${workspaceRoot}/hoge.rb"

Up to this point, it is possible to debug the .rb file while stopping at the breakpoint. To stop at a breakpoint, click to the left of the line number and add a red point. Then, select “Run” and “Start Debug” from the menu. Next, configure Ruby on Rails to work.

Rails installation

Enter the following in the terminal of Visual Studio Code. In the following example, PostgreSQL is specified for DB. Create a project named “test_project” and execute debug with “rails s” at the end.

gem install bundler
install rails
rails new test_project -d postgresql
cd test_project
bundle install
rails s

If something is missing, you will get an error, so follow the steps below.

Install webpacker, Node.js, Yarn

If you read the error message and it says that webpacker is missing, install it below.

rails webpacker install

If you’re told you’re missing Node.js or Yarn, download and install it.

Download Node.js Download Yarn

With the above, the local server is started by “rails s”. Open “localhost:3000” in your browser and the Rails page will be displayed.


If Rails does not start because the port number 3000 overlaps with other services, you can add the port number specification to launch.json.