Recently I encountered a dreaded issue whilst trying to install Laravel on my Mac OSX machine.
The message I was getting was:
Allowed memory size of 536870912 bytes exhausted (tried to allocate 72 bytes) in phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php on line 123
The issue was perplexing according to PHP I had allocated 128mb of memory for PHP, but apparently this wasn’t enough. It appears as though dependencies are managed within memory and all of the components that make up Laravel (mostly Symfony) take up more than 128mb of memory.
I am using MAMP for my local development environment and setting the memory to be higher in my PHP.ini file (even though my MAMP PHP is used as the default) didn’t change the memory size, so I had to try something else.
If you are using your Homebrew install of Composer, you need to actually download the .phar file instead. I found that the Homebrew install of Composer didn’t allow you (from what I could find) to specify memory usage.
Download Composer.phar
If you haven’t already downloaded Composer (the .phar file version) in your application directory you will want to run this: curl -sS https://getcomposer.org/installer | php
You will now have the Composer package manager file to run. We will be calling it like a PHP script.
Running Composer.phar
To run Composer without memory restrictions simply type: php -d memory_limit=-1 composer.phar update
Your application that was previously freaking out because of memory exhaustion will now run (hopefully).
Super. Thank you so much 😀