Scott Hanselman

The PICO-8 Virtual Fantasy Console is an idealized constrained modern day game maker

August 08, 2019 Comment on this post [4] Posted in Gaming Hardware Open Source
Sponsored By

Animated GIF of PICO-8I love everything about PICO-8. It's a fantasy gaming console that wants you - and the kids in your life and everyone you know - to make games!

How cool is that?

You know the game Celeste? It's available on every platform, has one every award and is generally considered a modern-day classic. Well the first version was made on PICO-8 in 4 days as a hackathon project and you can play it here online. Here's the link when they launched in 4 years ago on the forums. They pushed the limits, as they call out "We used pretty much all our resources for this. 8186/8192 code, the entire spritemap, the entire map, and 63/64 sounds." How far could one go? Wolf3D even?

"A fantasy console is like a regular console, but without the inconvenience of actual hardware. PICO-8 has everything else that makes a console a console: machine specifications and display format, development tools, design culture, distribution platform, community and playership. It is similar to a retro game emulator, but for a machine that never existed. PICO-8's specifications and ecosystem are instead designed from scratch to produce something that has it's own identity and feels real. Instead of physical cartridges, programs made for PICO-8 are distributed on .png images that look like cartridges, complete with labels and a fixed 32k data capacity."

What a great start and great proof that you can make an amazing game in a small space. If you loved GameBoys and have fond memories of GBA and other small games, you'll love PICO-8.

How to play PICO-8 cartridges

Demon CastleIf you just want to explore, you can go to and just play in your browser! PICO-8 is a "fantasy console" that doesn't exist physically (unless you build one, more on that later). If you want to develop cartridges and play locally, you can buy the whole system (any platform) for $14.99, which I have.

If you have Windows and Chrome or New Edge you can just plug in your Xbox Controller with a micro-USB cable and visit and start playing now! It's amazing - yes I know how it works but it's still amazing - to me to be able to play a game in a web browser using a game controller. I guess I'm easily impressed.

It wasn't very clear to me how to load and play any cartridge LOCALLY. For example, I can play Demon Castle here on the Forums but how do I play it locally and later, offline?

The easy way is to run PICO-8 and hit ESC to get their command line. Then I type LOAD #cartid where #cartid is literally the id of the cartridge on the forums. In the case of Demon Castle it's #demon_castle-0 so I can just LOAD #demon_castle-0 followed by RUN.

Alternatively - and this is just lovely - if I see the PNG pic of the cartridge on a web page, I can just save that PNG locally and save it in C:\Users\scott\AppData\Roaming\pico-8\carts then run it with LOAD demon_castle-0 (or I can include the full filename with extensions). THAT PNG ABOVE IS THE ACTUAL GAME AS WELL. What a clever thing - a true virtual cartridge.

One of the many genius parts of the PICO-8 is that the "Cartridges" are actually PNG pictures of cartridges. Drink that in for a second. They save a screenshot of the game while the cart is running, then they hide the actual code in a steganographic process - they are hiding the code in two of the bits of the color channels! Since the cart pics are 160*205 there's enough room for 32k.

A p8 file is source code and a p8.png is the compiled cart!

How to make PICO-8 games

The PICO-8 software includes everything you need - consciously constrained - to make AND play games. You hit ESC to move between the game and the game designer. It includes a sprite and music editor as well.

From their site, the specifications are TIGHT on purpose because constraints are fun. When I write for the PalmPilot back in the 90s I had just 4k of heap and it was the most fun I've had in years.

  • Display - 128x128 16 colours
  • Cartridge Size - 32k
  • Sound - 4 channel chip blerps
  • Code - Lua
  • Sprites - 256 8x8 sprites
  • Map - 128x32 cels

"The harsh limitations of PICO-8 are carefully chosen to be fun to work with, to encourage small but expressive designs, and to give cartridges made with PICO-8 their own particular look and feel."

The code you will use is LUA. Here's some demo code of a Hello World that animates 11 sprites and includes two lines of text

t = 0
music(0) -- play music from pattern 0

function _draw()
for i=1,11 do -- for each letter
for j=0,7 do -- for each rainbow trail part
t1 = t + i*4 - j*2 -- adjusted time
y = 45-j + cos(t1/50)*5 -- vertical position
pal(7, 14-j) -- remap colour from white
spr(16+i, 8+i*8, y) -- draw letter sprite

print("this is pico-8", 37, 70, 14)
print("nice to meet you", 34, 80, 12)
spr(1, 64-4, 90) -- draw heart sprite
t += 1

That's just a simple example, there's a huge forum with thousands of games and lots of folks happy to help you in this new world of game creation with the PICO-8. Here's a wonderful PICO-8 Cheat Sheet to print out with a list of functions and concepts. Maybe set it as your wallpaper while developing? There's a detailed User Manual and a 72 page PICO-8 Zine PDF which is really impressive!

And finally, be sure to bookmark this GitHub hosted amazing curated list of PICO-8 resources!

image image

Writing PICO-8 Code in another Editor

There is a 3 year old PICO-8 extension for Visual Studio Code that is a decent start, although it's created assuming a Mac, so if you are a Windows user, you will need to change the Keyboard Shortcuts to something like "Ctrl-Shift-Alt-R" to run cartridges. There's no debugger that I'm seeing. In an ideal world we'd use launch.json and have a registered PICO-8 type and that would make launching after changing code a lot clearer.

There is a more recent "pico8vscodeditor" extension by Steve Robbins that includes snippets for loops and some snippets for the Pico-8 API. I recommend this newer fleshed out extension - kudos Steve! Be sure to include the full path to your PICO-8 executable, and note that the hotkey to run is a chord, starting with "Ctrl-8" then "R."

Telling VS-Code about PICO-8

Editing code directly in the PICO-8 application is totally possible and you can truly develop an entire cart in there, but if you do, you're a better person than I. Here's a directory listing in VSCode on the left and PICO-8 on the right.

Directories in PICO-8

And some code.

Editing Pico-8 code

You can export to HTML5 as well as binaries for Windows, Mac, and Linux. It's a full game maker! There are also other game systems out there like PicoLove that take PICO-8 in different directions and those are worth knowing about as well. There is a rich tiny game development community out  there, and you'd do yourself a favor to explore sites like

What about a physical PICO-8 Console

A number of folks have talked about the ultimate portable handheld PICO-8 device. I have done a lot of spelunking and as of this writing it doesn't exist.

  • You could get a Raspberry Pi Zero and put this Waveshare LCD hat on top. The screen is perfect. But the joystick and buttons...just aren't. There's also no sound by default. But $14 is a good start.
  • The Tiny GamePi15, also from Waveshare could be good with decent buttons but it has a 240x240 screen.
  • The full sized Game Hat looks promising and has a large 480x320 screen so you could play PICO-8 at a scaled 256x256.
  • The RetroStone is also close but you're truly on your own, compiling drivers yourself (twitter thread) from what I can gather
  • The ClockworkPI GameShell is SOOOO close but the screen is 320x240 which makes 128x128 an awkward scaled mess with aliasing, and the screen the Clockwork folks chose doesn't have a true grid if pixels. Their pixels are staggered. Hopefully they'll offer an alternative module one day, then this would truly be the perfect device. There are clear instructions on how to get going.
  • The PocketCHIP has a great screen but a nightmare input keyboard.

For now, any PC, Laptop, or Rasberry Pi with a proper setup will do just fine for you to explore the PICO-8 and the world of fantasy consoles!

Sponsor: OzCode is a magical debugging extension for C#/.NET devs working in Visual Studio. Get to the root cause of your bugs faster with heads-up display, advanced search inside objects, LINQ query debugging, side-by-side object comparisons & more. Try for free!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
August 12, 2019 5:27
That's super cool, Scott. The cartridge approach is brilliant.;
August 12, 2019 7:29
I've been meaning to learn machine code and write something for a C64 or Spectrum all these years. Perhaps this is a good stepping stone. By the way Scott, noticed a slight typo:
"You can expert to HTML5"
August 13, 2019 16:50
Scott, Here's a typo 3rd paragraph from the top:
It's available on every platform, has one every award and is generally considered a modern-day classic.
August 22, 2019 2:39
You are my aspiration, I possess few web logs and occasionally run out from post :).;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Good, Better, Best - creating the ultimate remote worker webcam setup on a budget

August 06, 2019 Comment on this post [4] Posted in Remote Work
Sponsored By

I've been a remote worker and an occasional YouTuber for well over a decade. I'm always looking for a better setup because the goal is clear - how can I interact with you and my co-workers in a way that has high-enough fidelity that I don't need to drive to Seattle every week!

I believe if my camera is clear and my audio is clear than I can really have a remote relationship with my team that is effective and true.

Everyone has a webcam these days and can just get on a video call and have a chat - but is it of sufficient quality that you feel like you're really having a good conversation with folks and truly connecting!

Here's a shot of my setup during a meeting I'm in here at Microsoft:

My setup - webcam and camera

Here's my thoughts on Good, Better, add Best set-ups for remotes and YouTubers without spending thousands.


  • High quality video for Webcams and RemotesThe Logitech C270 Webcam can be gotten for as little as $20 or less! It's wholly adequate with enough light.
    • It only does 720p and it's USB2 so I can't enthusiastically recommend it but it's OK again, if you throw light at it. In the dark is just a webcam.
      Logitech C270
  • The Logitech USB Headset H570 is decent, as is the lovely Jabra UC Voice corded headset. I prefer the Jabra because it only covers one ear and doesn't give me the "two covered ears" claustrophobic feeling.
    • To be clear - audio quality matters. Any crappy headset (or quality one as above) will ALWAYS be better than your webcam's default or your laptop's default. Always. Mics need to be closer to your mouth to sound good.
  • Small webcam Ringlight.
    • Light light light. Webcams, especially cheap ones NEED LIGHT. It feels weird and I get it but the quality is SO MUCH BETTER with some decent fill light. Get a ring light that's powered by USB and use it on calls. Yes, it looks ridiculous but it WORKS.


Logitech BrioHow can we improve on the GOOD setup. Clearer videos and better sound/sound feel.

Some folks feel the Logitech Brio is overhyped and I think that's fair. It's a "4k" camera that's not as impressive as it should be. That said, it's a solid camera and arguably the best Logitech has to offer.

If I could suggest a middle of the road solid "BETTER" setup for a remote worker, I'd recommend these

The lights are the magic.

Now, moving beyond USB headsets, I love adding speakerphones - not for the mic, literally for the speaker. I love the Plantronics Portable USB Speakerphone. Requires no drivers, it just shows up as a mic and speaker automatically. I have it front and center in front of my monitor and I use it every day. It makes me feel like my Home Office is a real Office somehow.

Plantronics Calisto 610-M Portable USB Speakerphone

If conversations are private I'll use the headset above for the audio but when I want the sound to "come from the monitor" I'll SPLIT the audio. This is a pro tip. You can set up the Mic input as the headset mic and the Speaker output as a Speakerphone (or your main speakers). I like using the Speakerphone for voice and keeping the computer's output as the main speakers. Having this separate of voice and computer sounds is a small trick I play on myself but it helps to create a sense of location where the remote video person comes out of separate speakers.

Selecting Output Speakers


Let's spend a little bit of money, but not so much that we break the bank.

I'm going to make my own webcam. Rather than a plastic of the shelf single webcam, let's take an actual mirrorless camera - the kind you'd take to a photography class - and make it a HIGH QUALITY webcam.

We need a great camera and it needs to support HDMI out. The camera also needs to be able to stay on all day long, not overheat, and it needs to run on AC power (not on battery).

Here's a list of cameras that have clean HDMI out and can stay on all day. You might have one of these cameras in your closet! I like the Sony A6000 and here's its characteristics.

  • Sony A6000 - I found this on Craigslist for $300.
    • Max resolution: 1080p and a buttery smooth 60fps
    • Clean HDMI: Yes
    • Unlimited runtime: Yes
    • Connection type: Micro HDMI
    • Power: Dummy Battery
    • Verified by: Elgato
    • Notes: Requires dummy battery for power (sold separately) Retains full autofocus with clean HDMI output
      Sony A6000
  • I need a "dummy battery" for this camera. Turns out this is a whole class of thing you can buy. Who knew?
  • This camera has micro-HDMI so I need a micro-HDMI to HDMI cable.
  • Now this is just a loose camera, so how I will mount it on my monitor?
    • I like mounting it INSIDE the Ring Light. If you don't want the light you can just get this clamp mount.
    • Or you can do what I did - get the CLAMP then the LIGHT and then put the CAMERA in that like a sandwic
      Flexible Jaws Clamp Clip Mount Holder
  • This camera and cameras like it output HDMI and I need that HDMI to be inputted into my computer and I want the HDMI output of the camera to look like it's a regular Webcam. The magical device that does this for us is the Elgato CamLink 4k. It's literally a little stick with HDMI input on one end and a USB3 on the other side. It took 5 minutes to install.
    • This device also has the added benefit of being a generic "capture card" if you want to record or broadcast your gaming consoles OR other computers!

      Elgato CamLink 4k

Here's a YouTube video I made that shows you these cameras, before and after - Good, Better, and BEST!

Logitech Brio vs Sony A6000 with Elgato Camlink 4k - No Contest

What do you think? Thanks to John Miller and Jeff Fritz for their help and guidance!

* I use Amazon referral links and donate the little money to my kids' school. You support charter schools when you use these links.

Sponsor: OzCode is a magical debugging extension for C#/.NET devs working in Visual Studio. Get to the root cause of your bugs faster with heads-up display, advanced search inside objects, LINQ query debugging, side-by-side object comparisons & more. Try for free!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
August 11, 2019 5:29
Good post as always, thank you, Scott. At my company the problem is more basic and I would be happy to hear about tips how to make it better: although everyone has a webcam (the one built in to the laptop at least), no one is willing to use it. I’ve tried different tactics like starting the meeting by enabling mine, hoping that people will follow suit, etc. It only works with people I know well from real life, the rest is reluctant. Probably this is about meeting culture at the company. Any tips how could it be changed? Can it be a grassroots effort or does it have to come from top management?;
August 11, 2019 11:37
Now what you need to do is getting out of the "P" (automatic) mode. And open the aperture on the camera. It will reduce the dept of field and detached you from the background. Or in English... do a nice blur background. You could also move the circle light at 45 degrees to your right and set it not too bright. this way you continue to use the natural light and fill the shadow with your light. The result should be less flat... In any cases have fun and congrats!;
August 12, 2019 6:56
Do you work with Africa exclusively?;
August 14, 2019 2:38
Although I am not a remote worker, I and my team members occasionally work from home - but we do NOT need to see faces. Good audio is enough IMO. Still an interesting blog post, I didn't know you could use a mirrorless camera that way. Matt;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Dotnet Depends is a great text mode development utility made with Gui.cs

August 01, 2019 Comment on this post [10] Posted in DotNetCore Open Source
Sponsored By

I love me some text mode. ASCII, ANSI, VT100. Keep your 3D accelerated ray traced graphics and give me a lovely emoji-based progress bar.

Miguel has a nice thing called Gui.cs and I bumped into it in an unexpected and lovely place. There are hundreds of great .NET Global Tools that you can install to make your development lifecycle smoother, and I was installing Martin Björkström's lovely "dotnet depends" tool (go give him a GitHub star now!)  like this:

dotnet tool install -g dotnet-depends

Then I headed over to my Windows Terminal (get it free in the Store) and ran "dotnet depends" on my main website's code and was greeted by this (don't sweat the line spacing, that's a Terminal bug that'll be fixed soon):

dotnet depends in the Windows Terminal

How nice is this! It's a fully featured dependency explorer but it's all in text mode and doesn't require me to use the mouse and take my hands of the keyboard. If I'm already deep into the terminal/text mode, this is a great example of a solid, useful tool.

But how hard was it to make? Surprisingly little as his code is very simple. This is a testament to how he used the API and how Miguel designed it. He's separated the UI and the Business Logic, of course. He does the analysis work and stores it in a graph variable.

Here they're setting up some panes for the (text mode) Windows:


var top = new CustomWindow();

var left = new FrameView("Dependencies")
Width = Dim.Percent(50),
Height = Dim.Fill(1)
var right = new View()
X = Pos.Right(left),
Width = Dim.Fill(),
Height = Dim.Fill(1)

It's split in half at this point, with the left side staying  at 50%.

var orderedDependencyList = graph.Nodes.OrderBy(x => x.Id).ToImmutableList();
var dependenciesView = new ListView(orderedDependencyList)
CanFocus = true,
AllowsMarking = false
var runtimeDependsView = new ListView(Array.Empty<Node>())
CanFocus = true,
AllowsMarking = false
var packageDependsView = new ListView(Array.Empty<Node>())
CanFocus = true,
AllowsMarking = false
var reverseDependsView = new ListView(Array.Empty<Node>())
CanFocus = true,
AllowsMarking = false

right.Add(runtimeDepends, packageDepends, reverseDepends);
top.Add(left, right, helpText);

The right side gets three ListViews added to it and the left side gets the dependencies view. Top it off with some clean data binding to the views and an initial call to UpdateLists. Anytime the dependenciesView gets a SelectedChanged event we'll call UpdateLists again.

top.Dependencies = orderedDependencyList;
top.VisibleDependencies = orderedDependencyList;
top.DependenciesView = dependenciesView;

dependenciesView.SelectedItem = 0;

dependenciesView.SelectedChanged += UpdateLists;


What's in update lists? Filtering code for that graph variable from before.

void UpdateLists()
var selectedNode = top.VisibleDependencies[dependenciesView.SelectedItem];

runtimeDependsView.SetSource(graph.Edges.Where(x => x.Start.Equals(selectedNode) && x.End is AssemblyReferenceNode)
.Select(x => x.End).ToImmutableList());
packageDependsView.SetSource(graph.Edges.Where(x => x.Start.Equals(selectedNode) && x.End is PackageReferenceNode)
.Select(x => $"{x.End}{(string.IsNullOrEmpty(x.Label) ? string.Empty : " (Wanted: " + x.Label + ")")}").ToImmutableList());
reverseDependsView.SetSource(graph.Edges.Where(x => x.End.Equals(selectedNode))
.Select(x => $"{x.Start}{(string.IsNullOrEmpty(x.Label) ? string.Empty : " (Wanted: " + x.Label + ")")}").ToImmutableList());

That's basically it and it's fast as heck. Probably to be expected from the folks that brought you Midnight Commander.

Are you working on any utilities or cool projects and might want to consider - gasp - text mode over a website?

Sponsor: Looking for a tool for performance profiling, unit test coverage, and continuous testing that works cross-platform on Windows, macOS, and Linux? Check out the latest JetBrains Rider!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
August 06, 2019 6:50
This is like Unix curses. There's a JS lib called blessed offering similar functionality. Blessed has an issue on Windows though because they can't get mouse support working. Does the new Windows Terminal (and Gui.cs) have support for mouse input? Would be great to use the mouse wheel to scroll on those panes. ;
August 06, 2019 12:12
Great post. Gui is a nice project. I used it to create a dotnet tool (lazy) to handle solutions that deals with multiple git repositories. ;
August 06, 2019 19:54
Nice post Scott! Any chance you can create blog post on how to use this via Powershell for us Windows Sysadmin's in the crowd? :) I would love to make a TUI application in PS, since I am not a C# guy. ;
August 06, 2019 22:02
Looks like Miguel rediscovered Turbo Vision from ~2000. ;
August 07, 2019 6:58
Nice. Reminds me of the type of programs I used to make in Turbo Pascal :);
August 07, 2019 9:13
I like consoleframework. It's a Turvo Vision clone with support for XAML and mouse. ;
August 07, 2019 10:14
Nice tool, but wow the colors. The text is all but unreadable - light text on a light colored background? Anyway to change it?;
August 07, 2019 16:39
But does it work the same on Mac and/or linux? ;
August 08, 2019 17:01
I've been tinkering with a Powershell keyboard driven box-menu. It works pretty well so far, other than the tricky math on the scroll thumb for oversized lists.
┌─Select with spacebar─┐
│√first                │
│ second               │
│√third                │
August 08, 2019 17:26
Thank you so much for sharing an information about the text mode development. ;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Docker Desktop for WSL 2 integrates Windows 10 and Linux even closer

July 30, 2019 Comment on this post [13] Posted in Docker Linux Open Source
Sponsored By

Being able to seamlessly run Linux on Windows is making a bunch of common development tasks easier. When you're running WSL2 (Windows Subsystem for Linux 2) in a version of Windows 10 greater than build 18945, a BUNCH of useful and interesting scenarios light up and stuff just works.

Docker for Windows (download the Docker Desktop for WSL 2 Tech preview here) is great, but it has historically worked on Windows by creating a Hyper-V virtual machine called Moby that is visible within the Hyper-V client. It's a utility VM, but it's one you're aware of.

Docker for Windows using WSL2

However, if WSL2 runs a real Linux kernel in Windows 10 and it's managing a virtual machine platform underneath (and not visible to) Hyper-V client tools, then why not just let WSL2 handle containers for us?

That's exactly what the Docker Desklop WSL 2 Tech Preview aims to do. And just like WSL 2, it's fast.

...the time required to start a Docker daemon after a cold start is significantly faster. It takes less than 2 seconds to start the Docker daemon when compared to tens of seconds in the current version of Docker Desktop.

Once you've got a Linux (Ubuntu or the like) set up in WSL 2, you can right click on Docker Deskop and click "WSL 2 Tech Preview." This is a goofy and not-super-intuitive UI for now but it's a moment in time.

Click WSL 2 Tech Preview

Then you just hit Start.

NOTE: If you've already installed Docker within WSL 2 at the command line, stop it and let Docker Desktop manage its lifecycle.

Here's the beginnings of their UI.

Docker for WSL2

When I drop out to PowerShell/CMD on Windows I can run "docker context ls."

C:\Users\Scott\Desktop> docker context ls    
default Current DOCKER_HOST based configuration npipe:////./pipe/docker_engine
wsl * Docker daemon hosted in WSL 2 npipe:////./pipe/docker_wsl

You can see there's two contexts, and I've run "docker context use wsl" and that's now my default.

Here is docker images from Ubuntu, and again from Windows (in PowerShell Core). They are the same!

Docker images in Ubuntu
Docker images from Powershell

Sweet. Here I am using PowerShell Core (which is open source and cross-platform, natch) to manage my builds which are themselves cross-platform and I can run both a docker build or a metal build on both Windows or Linux, all seamlessly on the same box.

building docker images

Also note, Simon from Docker points out "We are using a non default dataroot in this mode to avoid corrupting a datastore you use without docker desktop in case something goes wrong. Stopping the docker desktop wsl daemon and restarting the one you installed manually should bring everything back." I noticed this because my "Windows Docker" and my original WSL2 docker had a list of images that I naively expected to be available here, but this is a new context and new dataroot so you may need to fetch images again in this new world if you're have been historically an active docker user.

So far I'm super impressed. Linux on the Windows Desktop feels right. It's Peanut Butter and Chocolate.

Sponsor: Looking for a tool for performance profiling, unit test coverage, and continuous testing that works cross-platform on Windows, macOS, and Linux? Check out the latest JetBrains Rider!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
August 01, 2019 6:33
Since WSL2 does not work under HyperV, does it mean that perhaps we eventually can get Windows /Linux mode images at the same time? Can the Docker engine figure out that? This would eventually enable scenarios such as CosmosDB image (windows-core) running at the same time as the Linux Redis, .net Core, ELK images? Or am I completely off?;
August 01, 2019 7:44
If, when, how will it run on windows server 2019? The dream would be to be able to run kubernetes master nodes in WSL2 on windows server 2019 without using Linux nodes.;
August 01, 2019 9:56
That's all cool, but I still can't get it to startup local Kubernetes - it seems to fail at downloading the k8s images;
August 01, 2019 12:01
This is pretty cool! Still playing around but, after switching to wsl context, it seems docker-compose still uses the default context to build/run images (docker run works as expected).;
August 02, 2019 1:24
Great stuff. I also like the subtle usage of Windows Terminal to host pwsh and WSL bash side-by-side. You must have built it from source since the new tab bar isn't in stable yet, so that's doubly impressive.;
August 02, 2019 14:52
This is gold, thank you so much for this 🙂;
August 02, 2019 17:53
It is hard for me now, to imagine world without Docker. But this technology was introduced so recently!;
August 02, 2019 19:59
Scott, Shame on Microsoft ending support for sending email from within a .net application using SmtpClient. I use this in several systems and it's quietly being retired by Microsoft. Recommending my financial trading application use a third party open source library which is less than Microsoft supported and a much larger business maintenance risk is an undesirable action. This small change removing a few API calls will cost my team thousands of dollars in development time, QA time, and down the road maintenance time (One developer day total cost is near $1,000 total cost). SmtpClient has this message about being obsolete. [System.Obsolete("SmtpClient and its network of types are poorly designed, we strongly recommend you use and instead")] From: Shame on Microsoft of shifting yet another cost from the vendor, Microsoft, to the customer (developer). What other APIs are silently going to be removed from .net or just not show up in .net core? The SQL Server team could not get away with this. Why does the .net dev team think it is an acceptable practice? Shame.;
August 05, 2019 20:54
Robert - I apologize for this. There’s some confusion as we have a documentation error that’s merging that attribute from two places. * It’s in the .net standard and it’s not going anywhere * it’s ok to use in .NET framework 4.x * it’s not recommended (but is useable) in .NET core. The intention was to mark it as Obsolete for cross-platform work because it does have historical issues. If you’re using it on 4.x and on Windows you can continue using it and being supported for many years. We are going to fix the documentation to make this distinction clearer.;
August 05, 2019 21:25
> * it’s not recommended (but is useable) in .NET core. Scott, That's as good as unsupported since the go forward .NET platform is .NET core. We develop financial systems and code outside of .NET core has to be vetted and approved by IT steering before being used (cybersecurity, business risk). My company is implementing large new systems in .NET core and our existing systems will be rewritten within the next few years in .NET core. We've had lots of wasted time trying to mix .NET core with standard or .NET framework and do not combine them in current development. All I am asking is can we have a Microsoft supported Smtp way to send email from within a .NET application and also one for a .NET core application? Not having it in .NET core will cost my team tens of thousands of dollars, add project risk and a longer term maintenance risk. We were expecting to re-use plumbing code from an existing .NET framework application for sending email on .NET core. We will not get a project to go back to .NET framework for our large system in development. Reverting to .NET framework would cost weeks for code, build, third party code quality tools, server configuration, etc. at the cost of about $1000 per developer day. Event a dumbed down Microsoft supported .NET core way of send emails, with attachments, BCC, CC and multiple recipients would work for us. Lastly, our CIO directed us to use 100% .NET core on this and future projects. The CIO want to have the business risk and large legacy cost of maintaining the entire ecosystem, build tool-chain and environments for mixing .NET core and .NET standard. What other common .NET APIs are not implemented, depreciated or broken in .NET core? Our team wants to use .NET core and not fight the inherit problems mixing .NET core with other .NET frameworks.;
August 09, 2019 9:30
Nice Really useful information provided keep providing ;
August 14, 2019 18:02
Very cool. Up to now I've stayed away from Docker (Elastic Beanstalk and ASP.NET Core in Lambda did the trick) but I have a project now where Docker will be used to run ASP.NET Core powered microservices. I found debugging a Dockerized ASP.NET Core app in Visual Studio 2019 to be a breeze. It just works. The cost of Visual Studio is more than justified by not having to fight with tools. Visual Studio Code -- pain to get it to debug the same app. Is there a plan to make WSL 2 jive with Docker and Visual Studio? Thanks!! ;
August 14, 2019 21:38
.NET Core does not support WCF server code. .NET Core supports only WCF C# client code. Even a simple way to write WCF server code with a decent security model would help. What's the go forward path to use .NET Core for our large WCF server code base? One system has hundreds of WCF server side methods used by clients and hundreds of thousands of lines of c#. We have multiple other large WCF server systems. How to budget for the tens of man-years needed to rewrite, QA, beta test, and cybersecurity test? Headline: Microsoft Abandons Core Server Technology;

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Ruby on Rails on Windows is not just possible, it's fabulous using WSL2 and VS Code

July 25, 2019 Comment on this post [10] Posted in Linux Open Source Ruby Win10
Sponsored By

I've been trying on and off to enjoy Ruby on Rails development on Windows for many years. I was doing Ruby on Windows as long as 13 years ago. There's been many valiant efforts to make Rails on Windows a good experience. However, given that Windows 10 can run Linux with WSL (Windows Subsystem for Linux) and now Windows runs Linux at near-native speeds with an actual shipping Linux Kernel using WSL2, Ruby on Rails folks using Windows should do their work in WSL2.

Running Ruby on Rails on Windows

Get a recent Windows 10

WSL2 will be released later this year but for now you can easily get it by signing up for Windows Insiders Fast and making sure your version of Windows is 18945 or greater. Just run "winver" to see your build number. Run Windows Update and get the latest.

Enable WSL2

You'll want the newest Windows Subsystem for Linux. From a PowerShell admin prompt run this:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

and head over to the Windows Store and search for "Linux" or get Ubuntu 18.04 LTS directly. Download it, run it, make your sudo user.

Make sure your distro is running at max speed with WSL2. That earlier PowerShell prompt run wsl --list -v to see your distros and their WSL versions.

C:\Users\Scott\Desktop> wsl --list -v
* Ubuntu-18.04 Running 2
Ubuntu Stopped 1
WLinux Stopped 1

You can upgrade any WSL1 distro like this, and once it's done, it's done.

wsl --set-version "Ubuntu-18.04" 2

And certainly feel free to get cool fonts and styles and make yourself a nice shiny Linux experience...maybe with the Windows Terminal.

Get the Windows Terminal

Bonus points, get the new open source Windows Terminal for a better experience at the command line. Install it AFTER you've set up Ubuntu or a Linux and it'll auto-populate its menu for you. Otherwise, edit your profiles.json and make a profile with a commandLine like this:

"commandline" : "wsl.exe -d Ubuntu-18.04"

See how I'm calling wsl -d (for distro) with the short name of the distro?

Ubuntu in the Terminal Menu

Since I have a real Ubuntu environment on Windows I can just follow these instructions to set up Rails!

Set up Ruby on Rails

Ubuntu instructions work because it is Ubuntu!

Additionally, I can install as as many Linuxes as I want, even a Dev vs. Prod environment if I like. WSL2 is much lighter weight than a full Virtual Machine.

Once Rails is set up, I'll try making a new hello world:

rails new myapp

and here's the result!

Ruby on Rails in the new Windows Terminal

I can also run "explorer.exe ." and launch Windows Explorer and see and manage my Linux files. That's allowed now in WSL2 because it's running a Plan9 server for file access.

Ubuntu files inside Explorer on Windows 10

Install VS Code and the VS Code Remote Extension Pack

I'm going to install the VSCode Remote Extension pack so I can develop from Windows on remote machines OR in WSL or  Container directly. I can click the lower level corner of VS Code or check the Command Palette for this list of menu items. Here I can "Reopen Folder in WSL" and pick the distro I want to use.

Remote options in VS Code

Now that I've opened the folder for development WSL look closely at the lower left corner. You can see I'm in a WSL development mode AND Visual Studio Code is recommending I install a Ruby VS Code extension...inside WSL! I don't even have Ruby and Rails on Windows. I'm going to have the Ruby language servers and VS Code headless parts live in WSL - in Linux - where they'll be the most useful.

Ruby inside WSL

This synergy, this balance between Windows (which I enjoy) and Linux (whose command line I enjoy) has turned out to be super productive. I'm able to do all the work I want - Go, Rust, Python, .NET, Ruby - and move smoothly between environments. There's not a clear separation like there is with the "run it in a VM" solution. I can access my Windows files from /mnt/c from within Linux, and I can always get to my Linux files at \\wsl$ from within Windows.

Note that I'm running rails server -b= to bind on all available IPs, and this makes Rails available to "localhost" so I can hit the Rails site from Windows! It's my machine, so it's my localhost (the networking complexities are handled by WSL2).

$ rails server -b=
=> Booting Puma
=> Rails 6.0.0.rc2 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.2-p47), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://
Use Ctrl-C to stop

Here it is in new Edge (chromium). So this is Ruby on Rails running in WSL, as browsed to from Windows, using the new Edge with Chromium at its heart. Cats and dogs, living together, mass hysteria.

Ruby on Rails on Windows from WSL

Even better, I can install the ruby-debug-ide gem inside WSL and now I'm doing interactive debugging from VS Code, but again, note that the "work" is happening inside WSL.

Debugging Rails on Windows


Sponsor: Get the latest JetBrains Rider with WinForms designer, Edit & Continue, and an IL (Intermediate Language) viewer. Preliminary C# 8.0 support, rename refactoring for F#-defined symbols across your entire solution, and Custom Themes are all included.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Hosted in an Azure App Service
July 31, 2019 6:01
Holy cow, Scott! I gave Ruby on Rails on VM on Windows and RoR on Plain Old Windows a valiant try for a couple of years, back around 2007, then gave up in disgust. Amazing that it only took a decade to finally get a working environment on Windows, and it's STILL Linux! Kudos for another great, clearly written how-to, maybe I'll give it another go just for fun.;
July 31, 2019 13:12
Hi Scott! Thank you for the great article! Just noticed that the link to VSCode Remote Extension pack is broken.;
August 01, 2019 10:46
I always have loved your articles, they are so thorough... For instance, you actually tell us how to get WSL in the terminal by editing the JSON file... No other article has mentioned that. I am super excited to try those out. Right now we are using an old Ubuntu 32 bit VM and Rubymine for development and I loath to use VS Code natively.;
August 01, 2019 17:28
Soooo, this is not Ruby on Windows, this is Ruby on Ubuntu hosted on Windows, amirite? So people, move on, nothing to see here, especially if you are already using a real operating system...;
August 01, 2019 19:57
I have run large Ruby on Rails applications on WSL 1 successfully on my laptop on Ubuntu 18.04. They run a bit slow, but run fine otherwise. The reason I mention that is you may not be able to update your windows installation to Windows Insiders release like me due to company policies, but you can work with the current release of WSL today;
August 01, 2019 20:20
@Bharat, have you been using RubyMine IDE together with WSL 1? I am curious if that combo is a viable set-up to develop Ruby on Rails on Windows 10 stable.;
August 01, 2019 22:39
I just made the jump to Fast to get this. Some issues though.
  1. Terminal was borked for Ubuntu until a reboot after converting to WSL 2
  2. I never did find how to connect to Windows Postgres from inside WSL 2 so I installed one in Ubuntu instead
  3. My parallel Selenium tests with headless Firefox don't seem happy - one at time seems Ok
  4. Windows Sublime with Linux files doesn't detect changes, i.e when you change Git branches
It is a whole lot faster with all the files in the WSL system and not shared from Windows.;
August 02, 2019 8:44
Thanks for an interesting article. I am curious, what are the advantages of your setup compared to running Ubuntu via Virtual Box? I've been using this setup for many years now, I wonder if there are reasons to change it to WSL2.;
August 02, 2019 9:22
Could you dive a little deeper into debugging? I can't get it to work.;
August 02, 2019 20:13
@Joto, I use VSCode. Currently, in WSL-1 there are some restrictions in the sense that you should not write anything on the Linux side from Windows, whereas you can write anything that you want to the Windows disk. It takes a bit of getting used to. As I understand, WSL-2 has no such restrictions. Rubymine should be fine. Just install it on Windows and run your Ruby on Rails SERVER on linux :);

(will show your gravatar icon)
Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, li, ol, pre, strike, strong, sub, super, u, ul) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.