Running numerous symfony versions using MAMP on Mac OS X

Sep
26

I was basically going to simply translate the symfony multi install tutorial I wrote ages ago but I realised, now that I have more knowledge, that this way wasn’t improved at all. So here is a quickest and cleaner way to run multiple symfony versions on a Mac using MAMP.

Required

In order to make this tutorial work, you will have to meet the following requirements. This tutorial hasn’t been tested on any other configuration so I can’t grant it would work (it should though).

  • Mac OS X Leopard
  • MAMP 1.7.2 already installed

Getting ride off conflicts

As you (might) know, Mac OS X is bundled with Apache and PHP. It might cause some conflicts between them and our MAMP install so we have to get ride off it first. To don’t remove it completly, we will just stop the bundled Apache (incase it’s running already). Here is what we have to do

  1. /usr/sbin/apachectl stop

Now that we have stopped Apache (if it was running already), we will make the MAMP’s one by default which is very simple. We will edit our .profile file as follow in a new bash. In it, we will add the following line

  1. export PATH="/Applications/MAMP/bin/apache2/bin":"/Applications/MAMP/bin/php5/bin":$PATH

Now, when we run a

  1. php -v

it should render something like “PHP 5.2.6“.

Importing symfony files using subversion

Since Leopard comes up with subversion already bundled, we will simply use it to fetch symfony files. First, we should setup a directory where we will put the libraries. For this exemple, I will use 1.0 and 1.2 version but the roadmap is exactly the same for 1.1 or 1.3. In order to put it in a “safe” place, I would use the newly created ~Library/symfony folder this way

  1. mkdir -p ~Library/symfony
  2. cd ~Library/symfony
  3. mdkir ./10
  4. cd 10
  5. svn co http://svn.symfony-project.com/branches/1.0

This way, we just brought back home the 1.0 branch. Let’s do the same with 1.2

  1. mkdir -p ~Library/symfony/12
  2. cd ~Library/symfony/12
  3. svn co http://svn.symfony-project.com/branches/1.2

Ending

Now that we have our libraries installed, we will add the commands to our bash by doing simply symbolic links in the /usr/bin folder this way (don’t forget to replace “username” by yours!)

  1. ln -s /Users/username/Library/symfony/10/data/bin/symfony /usr/bin/symfony10
  2. ln -s /Users/username/Library/symfony/12/data/bin/symfony /usr/bin/symfony12

Now you can run anytime anyhow any command of those 2 versions! To check that everything works correctly just type

  1. symfony10 -V
  2. symfony12 -V

You will now, just have to type the one you want to use ie:

  1. symfony12 init:project myprojectname

And voilà !

Related posts:

  1. symfony + Mac OS X + MAMP = coeur!
  2. Put your CSS, Javascripts and pictures files into subdomains using symfony
  3. Bug dans textmate
  4. Création d'un plugin Flickr pour symfony

 

One Response to “Running numerous symfony versions using MAMP on Mac OS X”

  1. [...] Update: A cleaner version of this has been written: Running numerous symfony versions using MAMP on Mac OS X [...]

Leave a Reply