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
-
/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
-
export PATH="/Applications/MAMP/bin/apache2/bin":"/Applications/MAMP/bin/php5/bin":$PATH
Now, when we run a
-
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
-
mkdir -p ~Library/symfony
-
cd ~Library/symfony
-
mdkir ./10
-
cd 10
-
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
-
mkdir -p ~Library/symfony/12
-
cd ~Library/symfony/12
-
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!)
-
ln -s /Users/username/Library/symfony/10/data/bin/symfony /usr/bin/symfony10
-
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
-
symfony10 -V
-
symfony12 -V
You will now, just have to type the one you want to use ie:
-
symfony12 init:project myprojectname
And voilà !
Related posts:
[...] Update: A cleaner version of this has been written: Running numerous symfony versions using MAMP on Mac OS X [...]