Increase CLI php memory limit on OSX
When running MAMP or MAMP Pro on a Mac OSX (this is on version 10 Yosemite) you will notice that PHP executed from the command line (CLI) will use different PHP settings than your website. In this case, OSX is using its own built-in apache server and php settings, not the ones defined by your MAMP setup.
You can easily change this though, as long as you know which php.ini to change.
First, check your memory limit, by running the following command on your SSH shell or local terminal:
php -i | grep memory
This will output something like the following:
memory_limit => 128M => 128M
Now, let's see which php.ini is used:
php -i | grep php.ini
This might return something like this:
Configuration File (php.ini) Path => /etc
It might also say on a second line which configuration file is loaded, but if that is not the case, OSX is using de default php.ini which is located in /etc/private/php.ini.default. In order to override the 128MB you will need to copy that file to the Path specified above, and change it:
cp /etc/private/php.ini.default /etc/php.ini
Note #1: You might have to use the sudo command to perform these actions.
Note #2: If there isn't a default php.ini at /etc/private, try the locate php.ini command in order to get a list of possible locations in your system.
Then, edit this file and change the memory_limit value to your preferred value:
Then restart your apache (and thus reinitialize php) with this command, or reboot.
That should do the trick.