A good development environment is always necessary for any Magento 2 developers.

Take a look at the list below which are installed on mac os x:

  1. Install VirtualBox v1.8.5
  2. Setup vagrant with PHP, Xdebug, Redis Server
  3. Install MYSQL in host machine
  4. PHPStorm
  5. Magicento 2
  6. Sequel Pro or similar MYSQL db client

Let’s go through them 🙂

  1. Install VirtualBox v1.8.5

The reason why I mentioned v1.8.5 because, if you are to use the same VirtualBox on the same machine for Magento 1.x, the later versions are not compatible with Magento 1.x. Hopefully it would be fixed soon!

2. Setup vagrant with PHP, Xdebug, Redis Server

Now if you never used vagrant, copied from Vagrant directly:

Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximise the productivity and flexibility of you and your team.

To achieve its magic, Vagrant stands on the shoulders of giants. Machines are provisioned on top of VirtualBox, VMware, AWS, or any other provider. Then, industry-standard provisioning tools such as shell scripts, Chef, or Puppet, can be used to automatically install and configure software on the machine.

Still not clear? If so continue reading or go to next paragraph -- vagrant app automates the vm creation process on VirtualBox. So, if you wanted to create a vm in VirtualBox, you would need to open VirtualBox app and do it there manually. But vagrant removes this boring processes. It uses a native file called “Vagrantfile” which contains all the instructions i.e. which os to be downloaded, CPU size, RAM etc. A Vagrantfile is pyhton script. Now depending on the task that we need to perform, we download a Vagrantfile or create a custom one, and run the command in terminal

vagrant up

Inside Vagrantfile we can also define to run a normal bash script! And inside this script we enter the linux command to install PHP, Xdebug, Redis Server and other tools. Using vagrant and the same Vagrantfile you can have multiple project setup with the same specifications -- that’s the whole idea behind using vagrant.

3. Install MYSQL in host machine

Now as simple as it gets install MYSQL server on host machine. A host machine is our machine where we installed vagrant, VirtualBox and guest machine is the vm which gets run when you enter in terminal “vagrant up”.

I suggest to use MYSQL in host it’s because if for any reason you need to remove/lose your vms created by vagrant, you will not need to worry about your dbs as they will be on your host machine.

The rest of the steps are very self-explanatory, just install those apps!

Hope this helps!

Categorized in: