Windows and Linux co-development

Can some of you folks who use Windows for development suggest some guides on workflow?

For example, regarding WSL (Bash on Windows), I’ve read stern warnings against modifying any WSL files from Windows. So that means I’m not supposed to use Windows Atom editor to edit files that exist in my WSL folders. However, it seems that trying to have my Git project in my Windows folders screws up all the permissions (creating a Git war with my Mac, since each side sees the permissions changing on all files).

Do any of you do your development purely in Windows, without WSL? (Git, iex, PostgreSQL!?, etc.)? If so, do you also have to do the Putty stuff to try to get working ssh keys?

I’m finding this quite a challenge moving from Mac to Windows for development… recipes for success would be very helpful :slight_smile:

Stay with Mac or move to Linux.

Even if it is possible to develop elixir projects on windows, I’d do this only if windows is the targeted platform to run the application.

I do totally refuse to use WSL, instead I use MINGW2 if I have to do something on windows.

Since I often have trouble when it comes to libraries that use NIFs, I try to avoid windows as much as possible. And if MINGW2 doesn’t help me out, I fire up a VM or a Docker-Container.

I had never problems with permissions in my git repository when doing the dance with linux and windows. The most common problem are the lineendings though, but after one has configured his git correctly (on both sides) it just works.

1 Like

I’m already at the point where I just may give up. It’s just almost impossible for me to believe the state that Windows is in compared to Mac. I want to rant and enumerate (partly because I fear some Windows defenders will not believe me), but it’s not worth throwing mud.

I’ll just hope this old Mac doesn’t die before I can sell this new XPS 15 and buy another rMBP. Apple does a lot of stupid things and makes what I think are some pretty poor decisions at times, but I now really know what I was giving up by trying to switch.

I tried WSL for a bit on Windows 10 but it was so buggy and so many things did not work due to limitations in WSL that I could not use it.

I’ve always done my elixir dev in a mingw bash shell with a windows-running atom editor. I use git, iex, postgresql and all forth just fine. I chose mingw so I can compile things like bcrypt without issue, plus I know mingw. ^.^

I would never ever recommend running Windows as a dev environment, for any language really (unless you are screwed/forced into using .NET or something), if you have the choice.

I tried just running a linux gui on hypervisor but could never get the GUI to display anything but black, with no errors, so I think Windows 10 hypervisor is borked, but that is not surprising either…

Work won’t let me wipe it and install a better OS… >.>

I just set a global/system-wide git option to just use linux style line endings, so much easier.

Oh I’ve already ranted in one of the hidden boards, don’t worry, there are not many (any?) Windows fan’s here. ^.^

1 Like

It is not about Windows vs Mac, but more about Windows vs *nix.

As You can see in this topic Which OS do you develop on? Ratio is about 8 windows to 82 *nix. (Edit: more recent poll here: Which operating system do you develop on (Poll))

So You don’t need to buy a Mac, You can go the Linux way :slight_smile:

Given my need to use Adobe Premiere and Illustrator, it’s Windows or Mac for me. But in terms of basic usability, I’m shocked at poor Windows is compared to my Mac.

For example, this old rMBP 15 will drive three large monitors in addition to its screen. But when I try to run just one 4k monitor on my new XPS 15 (with better Nvidia GPU), I get laggy external display, and limited to 30Hz refresh.

With Windows, I can’t have Docker and Virtualbox. I have to use a 3rd party program to manage my ssh keys!? (And it doesn’t integrate easily with everything.) Outlook 2016 on Mac has unified inbox, which is good since I have 8 different accounts I need to check. Outlook 2016 on Windows doesn’t have that feature, and the party line on the official windows forum is that the feature is only possible for POP3 accounts (which is obviously not true). I have a much longer list than this… these are just the ones I can think of off the top of my head.

Meanwhile, Apple won’t let me have their fastest laptop with an ESC key. Or > 16GB RAM. But now my complaints about my Mac seem insignificant.

2 Likes

Not necessarily… At my office I do have to work with some scripts that are required to have CRLF line-endings.

After I came in there and was the first one who tries to do as much on linux (in a VM though) as possible, we encountered a lot of trouble because of the line-endings. My boss wanted me to give up on linux for a subset of our repositories, but I dug into git-configuration then.

After a while I came up with a solution that suites us very well, and which I think should be more standard even in the OSS community:

1.) Configure git to preserve line-endings, on any system globally.
2.) Provide a .editorconfig which sets everything to LF, if necessary configure your editor manually.
3.) Add a per filetype config in the .editorconfig and your editors configuration to save certain files using CRLF.
4.) Provide a .gitattributes file with correct setting as described in Configuring Git to handle line endings - GitHub Docs (this is a good fallback for folks that do not adhere to 1-3)

I do think though, that a proper set up .gitattributes file would make steps 1 to 3 obselete.

I’m not sure what an rMBP is, but why selling the XPS? 8 years ago I had an XPS 17, it was about 4 years a constant shadow of mine, very reliable and one of the few laptops at that time that where capable of smoothly running a VM even on battery (well, only for 15 minutes or so, but you get it ;)).

Of course, linux is different to MacOS, but you will be able to use things you learned on mac, also you have a kind of freedom that neither windows nor mac will ever give you in how you wan’t your system to behave, to look, to feel, to speek… But maybe I am opinionated after more than 10 years of using primarily linux.

1 Like

I don’t thank goodness! ^.^;

Whooo!

Caps lock makes a far better escape key than ESC. (Also, ESC is still there, it’s just not tactile.)

1 Like

I develop almost exclusively on Windows these days, even though the WSL seems to be good enough to use if I wanted.

The things I do are basically,

  • Run the latest version of Windows not in the Insider track
  • Don’t use cmd use Powershell
  • Run iex with --werl
  • Set a Powershell alias and use the ssh client that comes with Git
    • It’s in git/usr or something
  • Use the posh-git PSModule
  • Use pgadmin or whatever gui that ships with Postgres
    • The CLI throws fits for me, though @OvermindDL1 probably has more experience with it than I do.
  • Don’t use anything Windows or *nix specific.
    • Easy for me, hard when working with others who don’t care as much
  • Set whatever editor you are using to always open up files in “Unix” mode.

There’s not a lot more special to my environment than that and a heavily edited Powershell profile. Maybe a couple other modules or programs that I don’t use that often.

As for things I don’t do but would recommend:

  • Get other Powershell Modules
  • I think there’s even an SSH module
  • Use Chocolatey
  • If you use WSL try to use it in your Windows directories
  • i.e. Don’t go into the WSL directories
  • It could really mess up your WSL installation
  • Don’t. Ever. Use. Putty… Trust me, it’s not worth it

I’ve never had this happen personally, mainly because I think that being in a situation where file permissions are a big deal is a smell itself, but I know there are situations where it is necessary.
I think the solution is something along the lines of running git config --global core.filemode false on just the Windows machine.

1 Like

Use the Windows 10 Mail Client, I think it’s better anyway. There are really not that many times I need to get into to outlook to do anything anymore.

This is because Docker works with Windows Server containers as well. I haven’t downloaded the new Docker that supposedly does this out of the box, but it runs on Hyper-V not VirtualBox. You can probably make it so that it uses VirtualBox instead of Hyper-V, but if you haven’t tried Hyper-V you should. I like it better than VirtualBox most of the time.

Like I mentioned in the other post, I use the ssh stuff that ships with msysgit, though now I think it’s just called Git for Windows. It ships with all the ssh stuff you need, just create a .ssh folder in your User Profile/Home directory.

These aliases are what are in my PowerShell Profile. Use Write-Host $PROFILE to find it’s location

set-alias ssh-agent "C:\Program Files\Git\usr\bin\ssh-agent.exe"
set-alias ssh-add "C:\Program Files\Git\usr\bin\ssh-add.exe"
set-alias ssh "C:\Program Files\Git\usr\bin\ssh-add.exe"

It also comes with ssh-keygen, but I only used a couple of times and was too lazy to create an alias.

Though I haven’t used ssh in awhile, and I think that I had it starting the agent and adding my key in my profile. When I stopped needing to SSH, I just took those lines out.

The only other thing is NIFs, you will need a compiler of some sort. I think that there is an Elixir package that uses Visual Studio automatically though? Either way I hate having a compiler in my path. But I have msys2 and mingw on my machine, and have a function that will add it to my path for when I do need it.

2 Likes

Thats not true, just use docker toolbox. On my system it is much more stable than docker4windows and does not need Hyper-V and therefore can be used in parallel to VBox (well, it actually depends on VBox).

Also it has a nice GUI which I sometimes miss on my linux system to manage images and containers…

I think the only big limitation now is symlinks and those fixed on the insider fast track I think. I would have to check again. There are working on adding other distros besides Ubuntu now.

I don’t Windows as a dev environment at all. Of course, most of my early development experience was using Ruby to automate things I was too lazy to do on Windows. At the time I would have preferred a Mac, but I was young, broke, and would have rather spent my money on a better PC than get a Mac. So I just made do with what I had.

That being said, after learning everything that I needed to make Ruby development work on a PC, there really isn’t THAT MUCH difference between development environments anyway. Windows just wasn’t *nix based and didn’t have logical defaults, whereas OSX was and the *nix compilers could run easily using *nix based defaults.

My second gripe is that some package authors will write their packages almost with express intent on not allowing their package to run on Windows. I’ve used to see people that even with a PR to add Windows support would say something like “No, go buy a Mac and stop using Windoze.” I haven’t seen that in years, but when I remember getting pretty upset.

Personally, I like PowerShell more than I like Bash. That’s a preference thing though. I wish there was a better and easier way to setup a *nix compatible compile environment, but the closest thing for that is msys2 with pacman. Which actually works pretty well overall.

Also, .NET Core was ported over to run on most *nix machines including Mac OSX. So you don’t have to strictly use Windows to develop for some .NET applications. (Obviously the Windows specific stuff you do.)

Really? It worked for me years ago without too much effort. It might have even been the rebellious and adventurous part of my life where I decided to learn how what Gentoo Linux was all about. You have to install the Hyper-V video drivers though.

I read that rant and laughed a bit. It looked like you had a rough day/week before writing that. Honestly, I would say that 90% of problems on Windows these days come from low ram and/or a slow HDD. Windows doesn’t make as effective use with it “swap” space as Linux does. 9/10 times just upgrading to a faster HDD or just getting an SSD will make everything behave better.

I use Windows since I remember, I tried mane time Mac OS but I really never liked it, actually I use Windows 10 (Creators update) and Elementary OS (Linux) in dual boot, It has been a pleasant experience, I have nothing to complain about

In fact, in my case, it is easier to develop Elixir in Linux than in Windows (Actually I’m using Windows just to play video games or develop them)

Disclosure: I work for Microsoft. But I don’t work in the Windows group or anything. I’m just commenting as a “user” here. :slight_smile:

I primarily do my Elixir work on Mac, but I did install WSL on a Windows machine and one of the first things I wanted to do was see if I could run one of my Elixir apps on it. For me it worked fine. I did some brief hacking on my app inside WSL. I did the editing in vim though, so I didn’t try editing with a Windows app as you said.

From my perspective it was pretty much the same as working on Linux. If I spent more time with it maybe I would have run into some bugs, but I didn’t encounter any that I remember.

Except I’ve yet to figure out how to get a GUI. Terminals work fine though… >.<

And a lot of networking calls that I use *all*the*time* (I work in IT), so I cannot even do stupid-simple crap like mtr or dig or so… To me, working in IT, bash for windows is fairly useless because their networking stack is borked to hell.

Hear hear. I may hate Windows with a bit of a passion (kept flamed up by constant daily work use), but anything I make even at home on my own time with my linux desktop I make sure works and compiles on Windows (often even mingw-compiling a build out).

To me the out-body is Mac’s. I can’t compile for them, I can’t run things on them, they are effectively dead to me. I cannot fathom why anyone would program stuff for them, or how, they don’t have any cross-compiling tools for other OS’s that I’ve yet to see… o.O?

Do elaborate? I don’t even get to the installer GUI when trying to show off some linux clients at work…

I have a habit of using every bit of RAM I’m given. At work I have 8 gigs, and Windows constantly freezes (it’s frozen 8 times today so far, I’m kind of getting used to it… >.>). At home I have 16 gigs on my desktop (max it supports, I need to upgrade, no money though… my wife is the one with the uber-desktop). My swap at home is configured for 16 gigs as well (on an SSD), and I’m always eating 32 gigs. Out of memory errors when running programs is not an uncommon occurrence for me. ^.^;

I really hate windows… my linux desktop never freezes even when memory is completely swamped… >.<

At work we’re starting to use Elixir but we have lots of old software in .NET, which forces us to use Windows mostly… To avoid switching the full environment too much I tried using WSL, if that could be a nicer devenvironment for our elixir software, to my surprise, I at least like it better than just windows…
The thing is you have to keep the source in the windows file system, edit it from there and just run the code from the WSL Bash… You should not edit files in the WSL filesystem from windows software though, from what I understand!
Before WSL there were some issues with native libraries, you had to make sure you hade VC++ environment variables available to compile stuff, and I’ve yet not been successful in automating that on boot…

Since the Hyper-V requirement for docker on windows I’ve come to hate that option though, otherwise it could’ve been nice to dockerize the software instead, I suppose… and then run it in docker everywhere.

Oh… That’s easy. It’s in Enable/Disable Programs and Features.
Or, assuming you’re running on Windows 10, in an elevated (i.e. Run as Administrator) PowerShell prompt run:

Enable-WindowsOptionalFeature -Online -All -FeatureName Microsoft-Hyper-V-Tools-All

It will tell you if you need to restart after that. Then it’s named Hyper-V Manager in your programs.

I mean, I never liked tools like mtr or its Windows equivalent of pathping. I always felt like they gave enough information to know where there was a problem, but not why my routing wasn’t working. But the stuff I did was only a couple of hops and used hand written route rules.

I use Get-Route and Test-NetConnection -TraceRoute quite a bit though. Also Test-NetConnection -port 443. Instead of dig I use Resolve-DnsName.

Of course, that’s only helpful if you didn’t know that PowerShell could do those things. It isn’t helpful if you just enjoy working in bash more. Personally, I find working in PowerShell a pleasant experience.

Haha, I remember showing an old co-worker what rvm and rbenv’s ruby-build did to make Ruby compile on a OSX. The worst was when people would shell out to which in Ruby. Perfectly good gems were deemed unusable on Windows because they called which at some point.

Uhh, sure. I’ll have to get back into it because it’s been awhile, but which distro were you trying to use? Also, maybe using the Hyper-V GUI will help a little bit. If I remember correctly there is a specific option you have to use to get video drivers correct.

Huh, I don’t know what to tell you. The problem we were having was people we getting 3GB blueprints and opening up 3 at a time in Adobe. Which would then spend a bunch of time writing the to the swap anytime that they went to a different program. After testing, 32 GB of RAM only increased speed marginally and increasing the swap space made it slower. Just upgrading to an SSD fixed the problem entirely.

Yep, I try to use msys2 there when I can. But as for the automation, I’m betting you didn’t consider using the profile loaded by PowerShell. If you did, what was the problem?

Why the Hyper-V hate? :confused: Is there something in particular that you don’t like?

1 Like

I use Windows for all my development.

  • Set .gitattributes to not do line conversions. Set your editor to use ‘\n’ for line endings.
  • When using LOAD DATA INFILE with MySQL, explicitly specify what the line ending should be.
  • Use either Git for Windows or Git in WSL. Do not mix them.
  • Native Windows apps can interact with the filesystem way faster than WSL apps, so you want to prefer ripgrep and git from Chocolatey over the same in WSL.
  • Use Chocolatey.
  • Use PowerShell.
  • Use iex.bat --werl.
  • Do not use MSYS2.
    • WSL is more compatible and Powershell is more usable, while MSYS2 is neither.
    • Docker4Windows CLI can’t do TTY emulation inside the MSYS2 CLI, while it works fine in Powershell and WSL.
  • Use git in WSL to set up things like executable bits for *nix-ers who interact with your repo. This will require you to clone the repo inside the WSL filesystem, but that’s actually pretty easy (git clone /mnt/c/.../some-repo/)
  • Use mount --bind /mnt/c/ /c/ to use the docker cli inside WSL to interact with Docker4Windows.
  • Have all supported platforms running in CI. Continuous Integration, particularly the implementation called BuildBot, was literally invented to help ensure cross-platform compatibility with a mixed dev team. Use it for that.

BTW,

Using a Linux VM, I just tied myself in terrible knots by moving a directory in one terminal while another one is in it. I ended up with two terminals that said they were in the same directory that were actually operating on completely different ones, and I got terribly confused when changes made in one didn’t show up in another. It involved a slow-running script, so I was context switching to do something else while it was running and losing track of what all was going on.

Windows throws an error if you try to move a directory while it’s in use. There are aspects of the UNIX filesystem that are objectively worse than the way Windows does it. Go ahead and fight me.

1 Like