I’ve found the best way to install symfony on Leopard is to use the version from SVN. I find this is easy to do, and easy to update in the future. Here is a cheat sheet for those looking to get up and running with symfony on their Mac running 10.5 Leopard.
I like to put new unix-y applications in /usr/local. I have mysql, svn, libpng, and now symfony in there too. So, let’s open up a terminal, and create the new directory.
$ mkdir /usr/local/symfony $ cd /usr/local/symfony
Now it’s time to checkout the code from the SVN repository. You can checkout whatever release you want, but it’s probably best to check out the latest stable version. If you want to take a look at what’s available, you can visit http://svn.symfony-project.com/tags/. As of this post, the latest version is 1.0.11. So, make sure you are in your new /usr/local/symfony directory and then type this:
$ svn checkout http://svn.symfony-project.com/tags/RELEASE_1_0_11/ .
You will see a long stream of files scroll by in your terminal window. That is all of the symfony magic getting loaded onto your computer. After it’s done, you can verify you got everything with svn info and will see a little status report:
$ svn info Path: . URL: http://svn.symfony-project.com/tags/RELEASE_1_0_11 Repository Root: http://svn.symfony-project.com Repository UUID: ee427ae8-e902-0410-961c-c3ed070cd9f9 Revision: 7177 Node Kind: directory Schedule: normal Last Changed Author: gregoire Last Changed Rev: 7177 Last Changed Date: 2007-01-20 09:22:33 -0500 (Thu, 29 Nov 2007)
Now, we want to set up the “symfony” command line tool. Rather than make calls like:
$ php /usr/local/symfony/data/bin/symfony [your command here]
…let’s add the symfony tool to our path so we can just type “symfony” and have that be that. Check to see if /usr/local/bin is in your path. If it’s not, you can add it. Here is what my path looks like:
$ echo $PATH /usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
There it is! First in the list. /usr/local/bin. If you don’t see it and want to add it to your path, open up ~/.bash_login with vi or your favorite text editor and add something like:
$ export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
Now, if you had to add to the PATH variable, you close your terminal window and open up a new one to get the latest PATH variables. Last thing will be to create a link to the symfony command line script in /usr/local/bin to it’s real location in /usr/local/symfony/data/bin/symfony. Yes, we could have just added this full path to our PATH, but that seemed a little messy to me. I’d rather not have to mess with my PATH any more and continue to put new scripts in /usr/local/bin. Let’s make the symlink:
$ cd /usr/local/bin $ ln -s /usr/local/symfony/data/bin/symfony symfony
Done! Now, you can type “symfony” from anywhere in the command line and it will run your shiny new SVN installation of symfony. If you want to go right into making your first symfony project:
$ cd ~/Sites/ $ mkdir shinyNewWebApp $ cd shinyNewWebApp $ symfony init-project shinyNewWebApp
When it comes time to upgrade, you can do this:
$ cd /usr/local/symfony $ svn switch http://svn.symfony-project.com/tags/RELEASE_1_0_XX
Feel free to share your experiences in the comments section.