monochrome photo of dark hallway

Developing with Windows

0

Well, the last four years, I’ve mainly been using Ubuntu and then MacOS for software development. In that time, the convergence of the two has been great. Now with tools like Homebrew, you can pretty much get the same scripts to run on Ubuntu (or most any version of Linux like Debian) that supports Bash working with the same script that works on MacOS.

It’s mainly a question of querying the $OSTYPE and seeing if it is `Darwin` which is the name for MacOS, or for Linux and you are pretty much there.

But I’ve avoided doing any work on Windows because it is so different. The thought of having to learn PowerShell when Bash is across the other two platforms seemed like too much. Now that I have two Windows machine again though, it would be nice to be able to write code for it and have all the nice tools working, so it really doesn’t matter what desktop OS happens to be around.

So on to some exploration and the net is that it is getting sort of better but it is still pretty inconvenient to develop things for Linux (compared with macOS):

  1. Windows subsystem for Linux Subsystem (WSL). Wow, this product has really matured. When it first came out, the idea of running bash directly on Windows was so cool, but this thing has really matured, you can now install it directly on Windows 10. It lives in a strange file system that isn’t part of the rest of Windows, but at the same time, you get Git and everything else. There is a bunch of tricky stuff that has to do with enabling WSL2 that I barely remember
  2. Brew, Scoop and Chocolatey to manage Windows utilities. The one thing I really missed the last time I used Windows was a package manager. Apt-get and the really good (now!) Homebrew for MacOS have made it really easy to configure both command line and graphical applications. A little google-fu led to Chocolatey which is a similar package manager for Windows. Wow you can now to `choco search authy` and get back a reasonable package. I did try to use the Windows Store, but this doesn’t seem to have any of the utilities that are in the Mac Application Store so if it is in the Windows Store you are back to a goodey. Also Choco seems super slow when it is doing things like updates. In general, I try Brew, then Scoop to get things installed in base Windows and then inside WSL, I use brew.
  3. The big connection was how to run Choco outside of PowerShell. I have a zillion Bash scripts and really don’t want to maintain more than one installation script. Well the answer is that you can just do a choco.exe search authy for instance and it works. Just adding the .exe seems to be the trick to run vanilla Windows executables.
  4. The other complexity is that you are really running two files systems. You would think that you would end up in your windows home directory when you start ubuntu, but this is not how it works, instead, you have to navigate to /mnt/c to get to the Windows file system which is pretty weird. A symlink helps a little but this is very different from the Mac.
  5. There are still many things that you can’t do inside the subsystem, so you are going to have to learn PowerShell for things like configuring and bootstrapping a Ubuntu system.
  6. The way that

So that’s the first installment, but my bootstrap on non-Windows machines looks like:

  • Install Choco and install scoop.
  • Install Linux subsystem with `choco install wsl-ubuntu-2004` which gets you to version 20.04, the current latest.
  • Install `choco install 1password` and get 1Password running and manually type in passwords
  • Get Dropbox (OK I’m replacing this with Google Drive, because Dropbox now required a paid plan if you have more than three devices attached. Argh!).
  • Once this is done, then comes a magic script which you can get with a git clone (ok I haven’t published this script, but you get the idea) and it should be off and to the races. This is actually pretty difficult to write so I normally just do it by hand as you need to learn PowerShell to run it.

Related Posts

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© All Right Reserved