Develop on Windows as if it was Unix
In this post I’d like to share a setup I recently found out and frankly love. I can’t always code on Linux, but I love the terminal and the environment, when working with open source software everything feels just easier, everything fits together without manually duct taping everything together.
With this setup you can get away with most of the simple daily tasks.
I’ll assume you have nothing installed, so starting from scratch…
cmd just sucks… Nevertheless there are some nice alternatives out there if you are willing to spend some time googling, recently I found out about cmder, it packages together conemu, msysgit and clink, to give you a really neat terminal with no configuration at all! It even packs the good ol’ monokai theme.
It’s portable so just drop it somewhere on your system. It packs with a
bin/ folder, so you can just drop anything you want to run from the terminal there.
Just by using cmder you get git, a decent terminal and most common unix commands (ls, mv, cp, grep, cat, etc)
It’s already in cmder! Isn’t that neat?
As we’ll be using the terminal quite a lot, I find Chocolatey to be quite nice!
To install just do
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
Do you need to install xampp?
cinst xampp.app will do! Remember you can choose where to install it, normally it’s in
Do you need ruby?
This little utility is just too good to miss, also, some common utilities (like composer) use it for a quick and easy installation.
To get it just do
I really like this little editor for quick editting,
cinst nano is everything you need to do if you want it!
It’s important to note that ^W is mapped to close tab so you will have to remove that mapping from cmder’s settings.
Do you use Vim?
cinst vim will do, of course, all vim users religiously know how to install and configure vim…
Duct Taping XAMPP
Well… It’s windows after all… I find doing this is easier than installing apache + mysql.
XAMPP does not add anything to Windows PATH so if you want to run
php in the command line
set PATH=%PATH%;D:\xampp\php, assuming you installed XAMPP in
If you do
php --version you should not get an error, if you do get an error check your XAMPP directory.
Another step, if you are going to use PHP’s
pear command, you’ll encounter an error like this
ERROR: failed to mkdir C:\php\pear\data\Auth\Auth\Frontend
ERROR: failed to mkdir C:\php\pear\docs\Benchmark\doc
ERROR: failed to mkdir C:\php\pear\data\Cache\Container
ERROR: failed to mkdir C:\php\pear\docs\Cache_Lite\docs
ERROR: failed to mkdir C:\php\pear\docs\Calendar\docs\examples
ERROR: failed to mkdir C:\php\pear\docs\Config\docs
This is because XAMPP doesn’t bother to configure pear, so, assuming you installed XAMPP in
D: to switch to that partition, then
pear config-set doc_dir d:\xampp\php\pear\docs
pear config-set cfg_dir d:\xampp\php\pear\cfg
pear config-set data_dir d:\xampp\php\pear\data
pear config-set cache_dir d:\xampp\php\pear\cache
pear config-set download_dir d:\xampp\php\pear\download
pear config-set temp_dir d:\xampp\php\pear\temp
pear config-set test_dir d:\xampp\php\pear\tests
pear config-set www_dir d:\xampp\php\pear\www
That’s good enough for pear.
All in all I’m pretty happy with that setup, and I keep improving it slowly, of course, I’m open to suggestions ;)