Getting Grunt to start your Rails server is extremely simple and quick if you just know how.

By the way, you might want to check out my How to Wire Up Ruby on Rails and AngularJS as a Single-Page Application tutorial before you proceed. I realize your existing Gruntfile.js setup might be different from mine, and I frankly have no idea if what I’m suggesting here will work if your setup differs.

First you’ll need to install grunt-shell-spawn:

$ npm install grunt-shell-spawn --save-dev

Next, add this to your Gruntfile.js :

grunt.loadNpmTasks('grunt-shell-spawn');

Then, inside the grunt.initConfig part, add this:

shell: { startRailsServer: { command: 'rails server', options: { // If async: true were omitted, the rails server // command would prevent subsequent commands // from running. async: true } } },

Lastly, add shell:startRailsServer to the server task.

Now, when you run grunt serve, you should end up with both localhost:9000 and localhost:3000 . (Again, if your Gruntfile.js setup is different from mine, I can’t guarantee that you’ll get the same result. If you know try my suggestion with a different setup, leave me a comment and let me know how it goes.)

Here’s my complete Gruntfile.js for reference.