PHPStorm 2016.3 changes to Terminal

Connect on Social

How to configure PHPStorm terminal to use GitBash on windows!

Being a developer who likes using Windows can sometimes have its quirks but using PHPStorm and configuring the Terminal to bash instead of CMD can be very helpful.

I have a preference to use bash, mainly sh.exe distributed with Git for Windows. If you are doing any development on Windows, you should have this installed and if not please go to Git for Windows and install.

In the previous version of PHPStorm, you would go to File -> Settings -> Tools -> Terminal and change the entry from c:\windows\system32\cmd.exe to something very similar to "C:\Program Files\Git\bin\sh.exe" -login -i. The double quotes around the file path are crucial. You may see some sites showing --login -l both will work.

The -login tells Bash to run it’s configuration files, and the -i tells Bash that you want interactive mode.

The changes to 2016.3 add a new setting which makes things a little more configurable. You now get to add a start directory. I use PHPStorm mostly for WordPress development, and I like to have the root of my site as the root of the project, but the source is usually a little deeper, e.g., “wp-content/themes/theme-name“. Configured this way you can drop the -login -i.

phpstorm-setting-tools-terminal

With the addition, you can set the start directory to either your theme location or your plugin location. If you work on both, as most of my projects have a theme and paired plugin for functional programming, you can set the root to wp-content/ Not a big deal but will save you some time.

If you are running Windows 10 Anniversary Update build 14393 or later (Press the windows key + R, type winver, press enter) you can try out WSL or Bash on Ubuntu on Windows.

This environment will allow users to:

  • Run common command-line utilities such as grep, sed, and awk
  • Navigate the file system using these commands
  • Run Bash shell scripts which rely on supported command-line utilities

Windows is running Ubuntu user-mode binaries provided by Canonical. This means the command-line utilities are the same as those that run within a native Ubuntu environment. Installation of Bash on Windows is just a few clicks.

I do use this a lot and have activated it in PHPStorm as my terminal. It will operate just like a Ubuntu bash and you can install PHP-CLI, Node, npm, Git. It is still in beta but is being heavily worked on by Microsoft. Check out the bash on Ubuntu on Windows installation guide


About Mr Wilde

Technology has been in my blood for as long as I can remember. Started with Dick Smith kits when I was 10, I was making FM wireless bugs in high school. After several years working, Electronics Technician, Sound and Lighting Technical Director and then IT Sysadmin, I am going with the flow and leaving the hardware behind, mostly. I am now developing solutions for the cloud, focus on WordPress, SharePoint and Mobile devices. Learning more and more every day.


Leave a Reply

Your email address will not be published.