# How Sam's Windows development environment is configured

**URL:** <https://meta.discourse.org/t/how-sams-windows-development-environment-is-configured/62444>\
**Category:** Development\
**Created:** [May 10, 2017, 3:49pm UTC](https://meta.discourse.org/t/how-sams-windows-development-environment-is-configured/62444 "2017-05-10T15:49:04Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [May 10, 2017, 3:49pm UTC](https://meta.discourse.org/t/how-sams-windows-development-environment-is-configured/62444/1 "2017-05-10T15:49:04Z")

</div>

I wanted to do a post (that I try to keep up to date) with notes about my current dev environment.

> ⚠ This was a setup I WAS using, I no longer really use it I develop on Linux native. This setup though is reasonable if you are on a Windows machine.

### My building blocks

- Windows 10 creators update
- [Wsltty](https://github.com/mintty/wsltty) which I prefer built in bash for windows console
- [VMWare workstation](http://store.vmware.com/store/vmware/en_US/pd/productID.323700100?src=ps_570c41fd1ed2e&kw=vmware%20workstation&mt=e&utm_source=google&utm_medium=ppc&utm_campaign=GS_eBiz_Lead_AMS_US_EN_BR_RLSA_Workstation&k_clickid=8496831c-55e5-47c0-9a78-6ae13e2eac7d&gclid=CjwKEAjw9MrIBRCr2LPek5-h8U0SJAD3jfht7cypaS23Oa1NFDVkZ90QPIsgun1xzZwzBfYUK-JhtBoChTPw_wcB) with latest Ubuntu installed
- [Mobaxterm](http://mobaxterm.mobatek.net/) cause its nice to have an X server
- Vim plus my [vim setup](https://github.com/SamSaffron/vim-setup) installed inside the VM
- [chruby](https://github.com/postmodern/chruby) plus a bunch of rubies for my dev
- [7+ taskbar tweaker](http://rammichael.com/7-taskbar-tweaker) cause Windows makes it annoying to ungroup icons
- [i3wm](https://i3wm.org/) - I use it almost exclusively on my 3 monitor setup

### Hacks

#### A desktop shortcut to my linux VM

I use this shortcut to access my VM - target:

```plaintext
%LOCALAPPDATA%\wsltty\bin\mintty.exe --wsl -o Padding=5 -o Locale=C -o Charset=UTF-8 /bin/wslbridge -C~ -t /bin/bash -c "DISPLAY=0.0.0.0:0.0 ssh -X ubuntu"

```

It adds a bit of 🎇 in that I have nice padding on my terminal and connect my mobax windows manager to the session so I can run stuff like `git gui` if I want.

#### A shortcut to puma

I use a custom shortcut to launch puma:

```plaintext
%LOCALAPPDATA%\wsltty\bin\mintty.exe --wsl -o Padding=5 -o Locale=C -o Charset=UTF-8 /bin/wslbridge -C~ -t /bin/bash -c "ssh ubuntu '(cd /home/sam/Source/discourse && echo `pwd` && . ~/.zshrc && cd ~/Source/discourse && bin/puma --kill-existing)'

```

This shortcut is pinned to my taskbar and allows me to easily launch puma when needed and easily find it.

 ![](https://global.discourse-cdn.com/meta/original/3X/2/0/20b462f68d964fd2bbad3ac37c739937bf1f3dee.png)

#### Using Chrome directly in Windows to access dev

I prefer running Chrome in Windows to running it in X Windows, I prefer the rendering Windows provides and it just works a bit faster in this setup.

I have it configured so `ubuntu` always resolves to my VM ip, I handle that by providing VMWare a static lease for the VM [per this article](https://bytealmanac.wordpress.com/2012/07/02/assigning-a-static-ip-to-a-vmware-workstation-vm/).

It basically means I edit:

`C:\ProgramData\VMware\vmnetdhcp.conf`

And add something like this to the conf

```plaintext
host ubuntu {
    hardware ethernet 00:0C:29:16:2A:D6;
    fixed-address 192.168.84.132;
}

```

Once that is done and my `c:\Windows\System32\Drivers\etc\hosts` file is edited to reflect, I can access my dev env using `ubuntu` instead of shuffling IPs. The IP is stable on reboot so this just works once setup.

 ![](https://global.discourse-cdn.com/meta/original/3X/1/d/1dd43b4843a16b6214b2ceaf597c4cc31a983774.png)

#### Seamless SSH from WSL to VM

I generated an RSA key in my WSL instance and use `ssh-copy-id` to stage the public key to the Linux VM.

This means I do not enter passwords when I `ssh` into the VM using the above shortcuts, this is critical to this workflow.

#### Better errors support

[Better errors](https://github.com/charliesome/better_errors) is the awesome gem that makes debugging in dev so much easier. Unfortunately, out of the box, it is super strict about who is allowed access.

I use a 🔨 to allow my Windows machine access to `http://ubuntu:9292/__better_errors` by adding this to my `.zshrc`:

```plaintext
export TRUSTED_IP:"0.0.0.0/0"

```

Feel free to use less of a sledgehammer, but completely losing out on better errors would be a huge shame.

#### Vim autospec

I use the Vim autospec configuration documented here: [discourse/bin/notify\_file\_change at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/bin/notify_file_change)

This means that as soon as I save a spec, autospec runs it using the power of 🎩

---

_[View the full topic](https://meta.discourse.org/t/how-sams-windows-development-environment-is-configured/62444)._
