Skip to content
Advertisement

OSX composer increase memory limit

I am having memory issues with composer; trying to increase the available amount above 128MO. I have been following the guidelines from composer.org but nothing seems to work.

If I locate php.ini on my machine I get:

/Applications/MAMP_2018-08-02_14-10-44/conf/php7.1.6/php.ini
/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
/private/etc/php.ini.default
/private/etc/php.ini.default-previous

I sudo /private/etc/php.ini.default and change MEMORY_LIMIT = 512MO

but when I do php -r "echo ini_get('memory_limit').PHP_EOL;" I still get 128 MO

now I try php -d memory_limit=-1 composer.phar but I get Could not open input file: composer.phar

locate composer.phar returns nothing….

What am I missing please ?

Advertisement

Answer

To run composer with no memory limit, first find out where your composer binary is with which composer. Use the resulting path like so:

php -d memory_limit=-1 /usr/local/bin/composer require etc/etc

You could also alias this: alias composer="php -d memory_limit=-1 /usr/local/bin/composer", which would allow you to call composer as you would normally.

Add that line to your bash profile if you want to use composer without limits permanently.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement