How to install and configure Symfony on your Mac? The answer to this question is not obvious and various people suggest different approach. I recently have installed Symfony on my machine and decided to share a few tips how to achieve it. Things are not that complicated once you know what you are doing. Let’s get strait to the point!
We could always you symfony sandbox but in order to gain access the the shell commands we need to configure our localhost and install Symfony on our local environment.
In this short quide I am going to describe how to install MAMP Pro 1.9 on MAC OSX Snow Leopard 10.6.4 and then how to install PEAR and Symfony 1.4 Framework.
Symfony is one of the most popular and powerful PHP (MVC based) Frameworks available out there. The biggest advantage of this framework is great documentation, huge community and millions of plugins to help you on your way. Symfony provides a complete solution to make your development processes faster and more efficient. On top of that, quality of your code becomes very high and further application expansion is easy.
First of all, install MAMP package. If you have any problems with installing it follow this tutorial: How to install localhost server on your machine – Installing MAMP. Make sure to setup your ports to default and select PHP version 5.
To install PEAR we are going to use go-pear.php as an alternative way to install PEAR on the Mac. As a shell command on your Terminal type:
Above commands installs PEAR on /Users/YOUR_USER_NAME/PEAR. Now we need to export this path and add it to the environment variable.
By confirming all on screen alerts you should install your PEAR. Now the PEAR should be installed and configured. You can check that by typing ‘pear’ as your Terminal command.
Now, we are going to install Symfony. Restart your localhost and terminal first. We have MAMP environment installed on the machine so symfony is going to be installed directly from the MAMP folder. After the restart type:
Make sure your php path folder is correct. Go to your MAMP Application folder and check if ‘peardev’ is available under this path.
We are almost done. The last thing we need to do is to link php and mysql socket to be accessible globally. Otherwise we will be not able to access ’symfony’ command and we will be not able to connect to the database from the shell commands and we will be getting PDO error.

We can set all up by typing:
To gain access to mysql commands from the shell:
Again, make sure the MAMP paths match with yours.
Once all is done, you should be able to have access to ‘pear’ and ’symfony’ from your Terminal.
Enjoy using this great PHP framework.
Latest Tweets
Partners
Resources
Become a Guest Author
About the Blog Author