Today I was trying to install Symfony on OSX and I get the famous "Allowed memory size of 536870912 bytes exhausted" error.
If you installed Composer via Homebrew, just update it.
$ sudo composer autoupdate
And that's all.
But, If you didn't install Composer trough Homebrew, try to increase the PHP memory limit in your php.ini
Disclaimer: I didn't used this, but I'm documenting it just in case.
It's located on /etc/php.ini but if you don't have that file, just copy one of the example files and use it as your php.ini.
$ sudo cp /etc/php.ini.default /etc/php.ini
Once you have it, edit with any editor (you'll need to be sudo)
$ sudo vim /etc/php.ini
Find memory_limit and set it to 1G
That might solve the problem, as found on the intertubes ;)