Symfony 2: Installing the Doctrine Migration Bundle on Mac OS Snow Leopard


I learned that the DoctrineMigrationBundle does not come as part of the default Symfony 2 install and that you must manually install it. The documentation for installing it on the main web site is really an oversimplification of what you’ll have to do on a Mac OS Snow Leopard situation as I discovered. In turn, I decided to post this blog to help others that may encounter similar problems.

The first thing is that you probably should install Macports. I already had a version of Macports on my laptop so I won’t go into detail on how to do that. However, in my case, my stumbling block occurred when I discovered how out-of-date my Macports was. The problem I discovered was that composer attempted to grab the Doctrine Migration Bundle via git, which was not installed by default on my Mac. That’s why you’ll probably want to use Macports as it will manage the installation/upgrade for you.

If you install it right now, you probably will not have the same issues as I did. If your ports are out-of-date like mine were, then that’s where you’ll be forced to spend a good morning (or afternoon) updating your system. This, of course, is even before attempting to tackle getting the Doctrine Migration Bundle installed.

First, you should run the command:

port selfupdate

If this command fails on your system, then you can give the full path (which should be under /opt/local/bin/port). This command will update the indexes but not upgrade your packages. It might take some time for this command to work so be patient.

Next run the following command to begin to update your ports/packages:

port update outdated

Along the way, you might encounter an error with one of the packages as a dependency (gettext I believe). The problem is that the index might have been corrupted and you’ll need to correct that. So once again, you’ll need to run the selfupdate command, except with the -v argument like this:

port -v selfupdate

This is where the frustration might start as the -v argument will cause selfupdate to run in a verbose mode showing you all the output. This command will take a while (especially if you haven’t updated your system in a while). So go out, grab some coffee, watch a small movie, etc. But once you fix that issue earlier, you can re-run port update outdated command to finish up. This time it should work. When I googled this issue, I found out that it might’ve been a Snow Leopard specific problem.

With your ports up to date, you can now install git. The recommended method is to run the following command:

port install git-core +doc +bash_completion +gitweb

From the git site, it might’ve added the +svn command. In my case, I already had subversion installed so I avoided putting it here.

With your system updated and loaded with git, you can finally work on getting the Doctrine Migration Bundle installed. The documentation on the Symfony website mentions that you should add the following line to your composer.json (located in your symfony directory) file:

    
"require": {
        "doctrine/doctrine-migrations-bundle": "dev-master"
    }

This is only partially correct as you’ll run into an error where you’ll be missing another dependency. Instead of copying and pasting that line, open your composer.json file up and locate the “require” key/hash data structure. Inside of there, add at the bottom the following two lines:

"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master"

Now, you can run composer (if you followed my other blog on installing Symfony 2, you should be able to just run the next command)

composer update

Originally, when I ran this command, I had another issue involving the certificate. I think what happened was that my ports were out-of-date and that my certificate was old. So that was another reason to update my ports. This time around, I was able to successfully install the Doctrine Migration Bundle without any issue.

(Visited 108 times, 1 visits today)

Comments

comments