Running Bash on Ubuntu on Windows from Atom


I absolutely love using Atom, and I am trying to use it to develop for the Vex Robotics platform “Convex”, but I can’t get my compiler working through Atom.

In short, I’m using Windows 10’s new Bash on Ubuntu on Windows feature for the arm cross compiler. I can successfully call the bash command line from Eclipse, but cannot seem to get it working from Atom. I have tried spawning extra command processes on top of command processes, but the problem seems to be one of permissions.

For example, when I run

dir C:\Windows\System32\bash.exe

A cmd process from Atom always says that the file bash.exe doesn’t exist, and yet in both Eclipse and a non-admin Command Prompt window it works just fine.

Is this some bug within Atom or one of its frameworks, or else, could there be a workaround other than opening a batch file manually from Explorer?
EDIT: I’m working on a workaround now, see below


Are you using the PlatformIO terminal? Have you tried running Atom in administrator mode and seeing if that gives it the permission to invoke bash.exe?


I tried the PlatformIO terminal after you mentioned it (without success), but mostly I’ve been using either the “script” or “build” packages. Also trying Atom in admin mode made no difference whatsoever.


You need to include a lot more detail about what you’re doing if you want other people to be able to reproduce it and attempt to figure out what’s wrong. I guessed PlatformIO because it’s the suite designed for developing for embedded devices in Atom, so it would make sense for an ARM project. Walk me through what you did with script and the PlatformIO terminal, separately. What commands do you use once you’re in the bash environment?


Right now, I have installed make and gcc-arm-none-eabi on the Bash on Ubuntu on Windows system. In the future, I plan to use it much more, but currently, I use bash mainly for make all for this project right now (and echo hi for testing bash).

The big problem is that I cannot even get into the bash environment via Atom. Whenever I try to enter, it seems Atom doesn’t have the permissions to access the bash.exe executable. Node’s child_process.spawn (or similar function) will return something along the lines of check if the executable exists your that you have sufficient permissions and even the cmd /c [command] way returns ‘bash’ is not recognized as an internal or external command, operable program or batch file.

There have currently been 4 ways I have tried to start bash via Atom:

  • via the Build package and a custom build command
  • via the Script package and a test batch file
  • via the script and Node’s child_process.spawn function
  • via the PlatformIO terminal (just because you mentioned it)

all with multiple test commands (bash 'echo hi', cmd \c bash 'echo hi', dir C:\Windows\System32\bash.exe), and yet none of them can access bash.

However Eclipse (with some finagling) was able to enter bash, it just couldn’t handle the output (error 0x8070057) as Eclipse used an old version of the command line (there are sometimes workarounds). Also, just starting Command Prompt from the Start menu lets me access bash. I have a feeling that somehow, Atom’s security principle is not included on the bash.exe file. I just don’t know how to find Atom’s security principle.

bash.exe allows execution from:

  • Administrators
  • Users
  • TrustedInstaller

Now I suppose I could edit these security settings, making it so that Everyone could access bash, or if I find Atom’s security principle, just Atom instead. However, I am running Windows Insider, and programs like bash get updated frequently, so to my knowledge, these modified permissions wouldn’t stay. I would like to find a more permanent solution instead if possible.

I started using the dir command to check if the command line had the right permissions to access bash, since I was able to narrow the problem down to permissions, and because it’s harder to mess up syntax with (no weird escaping characters or strings). At this point I can’t even see or access the bash file from Atom at all.

If I need to, I can upload my code to Mega, but I have no problems with it when running commands from the Command Prompt, so it seems irrelevant.

(also, sorry about the lack of information, I’m still getting used to participating in forums)


I found another workaround, which involves C++ programming for 2 extra executables. tl;dr it is a “simple” system which uses standard permissions from the command line as a relay for bash commands from Atom.

The server program starts on startup, hosting a named pipe, and translating received data into bash commands. Then it concurrently sends the live bash output data back to the client. This program should have sufficient permissions to access bash so it circumvents the permissions problem.

The other client program, is simply a command line tool that sends data over the pipe to the server program, and immediately prints any data it receives out to stdout.

It seems like a little bit of overkill, but theoretically, it is a permanent solution. I will provide updates as I go.


Alright, so I have written the two aforementioned programs, and they work together properly so far, except that bash does not like to be piped. When my server program calls bash, it gets the same error Eclipse got. I made a gist from my code here:

I think I know how to get away from this error code like Eclipse did. Instead of creating a new process for bash and piping the output back to my program, since bash doesn’t like pipes, I can call it in the main thread, with stdout redirected to a string, and in a separate thread send the data back over to Atom. (this is just theory so far).

Also, to get around one of the problems with pipes, I had to use an ‘unused’ (private) Unicode character as my message-terminating character.


I am probably spending more time on this problem than I should be. I’ve got AP homework to finish.

I have done some more testing, still without success. This time I tried calling system("bash -c ...") and overwriting stdout to a file, and yet I still got the same error. It looks like I might have to use the ReadConsoleOutput function, which means my implementation will not be efficient (I would have to constantly check the output, subtract the new difference, and send that back over the pipe). Or (and this is what I’ll probably do), I could look through cmd.exe's assembly and figure out how it’s screen buffer works. (Wish me luck)


Good luck. At this point, I would have settled for doing it all via the terminal window.

Is there any issue with checking ReadConsoleOutput 100ms after you send a command, and then every 500ms after that? Is there stuff that you would miss if you were half a second late on learning about it? With that big of a delay, having several operations won’t add up to much.


I’ve also settled for using just the terminal until this is finished, but I figure this is both a learning opportunity and something that would help a lot of people out. Especially because Microsoft doesn’t seem to have touched this issue for quite a while now.

Also, I’m just concerned that when using ReadConsoleOutput somehow bash might fill up the console screenbuffer before I can read it all, meaning that I miss some data. For example, the command apt list would probably cause this problem. Thanks for the suggestion though, I’ll see what I can do.


Any progress on this?


Yes, it appears this has been a bug in windows all along. The most recent build of Windows 10 Insider fixes this issue apparently, according to this article, but I haven’t had much time to test due to school. Either way, because bash output can now be piped, the last problem is finding a permanent solution to being able to call it, as mentioned above. Here soon I will try to do some proper testing and get back to you, but yes, there has been progress finally!


Fantastic! I’m looking forward to it! I’ve wanted to something like this for a good while.


Just figured it out I think. Since Atom doesn’t have permissions to view bash.exe, we need only make a file that Atom does have permissions to. In this case, we can use the command mklink bash.exe "C:\Windows\System32\bash.exe" in an elevated command prompt to do so. This creates a symbolic link pointing to bash.exe, in the current working directory. This is also practically a permanent solution, because the symbolic links point to where bash.exe is located, but do not include Bash’s contents; so it shouldn’t matter if Windows decides to update Bash!

Update: Definitely works!!! (Just spent about 6 hours trying to add features to the plugin atom-shell-commands to make all of this easier, after realizing that most terminal packages don’t handle paths with spaces very well. Will also add more to it if I can, because the package can really be awesome. Anyway, I got the package to work, and successfully tested using Bash)


thanks it’s working like charm


Is this command something I would have to run in every project folder I am working on with Atom?

When you say:

This creates a symbolic link pointing to bash.exe, in the current working directory.

…is that what you mean, or is there a way to set Atom with the platformio-ide-terminal plug-in to just always use bash?



Once you have created a symbolic link from somewhere on your PATH, Atom can see it from anywhere on your computer. So, yeah, if you want to do it in individual project folders, then you have to do it in all of them. But you can make a C:/bash folder, create the symlink in there, and then add that to your PATH.


Thanks @DamnedScholar :slight_smile:

I was able to get bash to work in Win10 Atom like so:

Setting up Atom with an integrated console: (PShell is default on Win10)

  1. ctrl+, for settings
  2. select Install from the Settings tabs
  3. type in platformio-ide-terminal
  4. Install
  5. NOTE: ctrl + tilda/backtick (~/`) to launch a new terminal in Atom.
  6. alt + shift + t to make a new console
  7. alt + shift + j/k to cycle through them
  • Setting up Atom for Git Bash integrated console:
  • NOTE: article says to set to: C:\\Windows\\sysnative\\bash.exe
  • but I set to: C:\Program Files\Git\usr\bin\bash.exe for it to work.
  • if neither work, in Git Bash console, ascertain $ which bash and use the Windows syntax C:\path to bash.exe.


I use the option Shell Arguments and write bash


I’m guessing that you’re using a 64-bit version of Windows. Due to WOW64 file system redirection, a 64-bit version of Windows expects bash.exe in C:\Windows\SysWOW64 rather than C:\Windows\System32.

I’ve seen people on Stack Overflow recommend copying bash.exe to that directory, I think that’s a terrible idea. Have you tried using an absolute path, e.g. %SystemRoot%\System32\bash?