Sam
Sam

Reputation: 1828

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 ?

Upvotes: 10

Views: 9526

Answers (2)

Viraj Chorghe
Viraj Chorghe

Reputation: 31

To have no memory limit, set this directive to -1

php -d memory_limit=-1 which composer install

Upvotes: 0

OK sure
OK sure

Reputation: 2656

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.

Upvotes: 40

Related Questions