Installing locally

Gitpod and Codespaces are a wonderful solution for getting up and running with a project quickly. You don’t have to install anything on your own machine, which means you can work from any device — a Chromebook, a work-issued laptop, even an iPad. You can instantaneously dive into any codebase, for example when code reviewing a colleague’s PR, without having to worry about Ruby or gem version conflicts with whatever you’re working on (“dependency hell”).

But there are drawbacks to using cloud-based development environments, and at some point you’re going to want to install Ruby and Rails on your own machine. Some benefits of local installation:

  • You can run rails new yourself to generate a brand new application.
  • Your computer probably has vastly more CPU and memory than Gitpod instances.
  • There’s no subscription fees for writing code on your own machine.
  • You can work offline, like when you’re on an airplane.
  • You can use other text editors, like JetBrains’ excellent RubyMine.
  • While it’s possible to develop native desktop/mobile applications in Gitpod, it’s a little clunky. It’s probably better to develop native apps locally.

There are some hassles involved with local installation, which is why we avoided it initially. But, eventually, the time will come to add this tool to your belt. Here are some suggestions for doing so.

Windows

Installing Ruby is a little bit more complicated on Windows than on MacOS or Linux. This is due to the fact that most Ruby programs are deployed to servers running Linux, and so that is what Ruby is most optimized for. MacOS shares DNA with Linux (both UNIX-based), and MacOS is probably the most common platform among Ruby developers (it’s best to have your development environment be as similar to your deployment target as possible), so installation on Linux and MacOS is more battle-tested than on Windows.

That said, installation on Windows has gotten a lot better over the years. Here is what I recommend:

Simplest: railsinstaller.org

  1. My recommendation for right now is to use the single-click installer offered by railsinstaller.org. Follow the instructions at installrails.com. (It appears the railsinstaller.org website is down as of this writing, but you can download the .exe file from GitHub).
  2. At the step where it asks you to install Sublime Text, I recommend instead using VSCode since it is nearly identical to what we’ve used in Gitpod. Later, you should experiment with customizing VSCode. Even later, you should try out RubyMine and see which you like best.

Better: Windows Subsystem for Linux

Microsoft has done a 180 and fully embraced Linux; to the extent that you can now install Linux within Windows using the new Windows Subsystem for Linux (WSL) feature in Windows 10. It’s still in beta and not totally perfect yet, but it’s probably something to look into if you insist on writing Ruby on Windows.

GoRails has a good guide for getting set up with WSL + Rails.

Mac

Docker

In the long-run, I believe the best solution for both Windows and Mac will be to Dockerize your Rails application. Docker makes it easy to deploy applications to any cloud infrastructure provider (Amazon AWS, Microsoft Azure, etc) by providing a standard way to package up environments; but in doing so, it also makes it convenient to set up development environments for each app without running into dependency hell.

But investing energy in learning Docker is probably not worth it right now if it’s only for development environment purposes. A couple years from now after you have dozens of Rails apps on your machine, all using different version of Ruby and various gems, and you’re feeling then pinch of dependency hell: that will be the time to explore Docker.

Get more familiar with the command-line

Now that you’ll be navigating multiple folders on your own computer, as opposed to a single folder per Gitpod workspace that has only one application in it, it would be good to become more familiar with the command-line.

Here is a nice brief intro to the shell, from a larger course called “The Missing Semester of Your CS Education” from MIT.

Another resource is Unix for the Beginning Mage. The first three chapters are a good place to start for now; eventually, you might want to read through all of it.