SUBSCRIBE VIA RSS


Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.

Topics

TWITTER

Stack Overflow


The old fashioned way

RECENT TUNES

January 24, 2008 – 4:37pm Installing Symfony on Leopard

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.

Posted by in  OS X Web Development   |  

4 Responses to Installing Symfony on Leopard

  1. Scott Meves says:

    If anyone is looking to link to the symfony code from within your project (for easy deployment to a server, for example) you can use svn:externals. Dave Dash has a great post about this at http://spindrop.us/2007/04/17/tips-for-symfony-and-subversion/

  2. Pingback: mummey.org » Blog Archive » Installing Symfony on MAMP

  3. samuel morhaim says:

    This is a semi old post, but, question:

    Installing via SVN or via PEAR, the only difference I see is that installing plugins is not that easy.. with pear, you can use symfony cli, but with SVN you need to set them up manually? I am confused.. can you clarify?

  4. Scott Meves says:

    @samuel, I always chose SVN over pear so that I can keep code versioned and distribute it to other developers when necessary. With SVN I don’t use the symfony plugin:install command line task, but just set up an SVN external. If your project is already in SVN then adding externals is really easy. If you aren’t planning on using a version control system, then you might as well install the plugins using the PEAR method. To see how I set up a new project with SVN (including setting up an external for symfony itself) you can check out http://stereointeractive.com/blog/2008/12/10/starting-a-new-symfony-project/ .

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>