Lots of things went wrong in trying to get PHP + Composer+ Laravel to work on my El Capitan mac and so I document the quick & dirty instructions below.
Step 1: Get homebrew
If you don’t have
brew already, everyone’s judging you. EVERYONE.
The missing package manager for macOS.
Make sure you configure your
brew path to a non-root directory. I’ve set mine to
/usr/local/bin . Also, ensure that
/usr/local/bin comes before
/usr/bin on your PATH variable. For example, add the line below to your
~/.bashrc or whatever-you-have.
Step 2: Get PHP
$ brew tap homebrew/homebrew-php $ brew install php72
Step 3: Install composer
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" $ php composer-setup.php --install-dir=/usr/local/bin --filename=composer
In case you run into old openssl issues, make sure you install openssl with brew and point to your new openssl. Here’s a nifty StackOverflow reference, but be warned that this might not be a good permanent solution:
Homebrew refusing to link OpenSSL
I'm on: OSX 10.11.6, Homebrew version 0.9.9m OpenSSL 0.9.8zg 14 July 2015 I'm trying to play with with dotnetcore and…stackoverflow.com
Step 4: Install Laravel
$ composer global require "laravel/installer"
Common issues while installing Laravel:
Now, you might face this horrendously unhelpful error, in a vivid red background on your terminal:The process has been signaled with signal “5”.
To see more about what’s happened, run the composer command again with the
$ composer global -vvv require "laravel/installer"
This will now output a series of commands that are being run. Figure out the last command that was tried before the error comes up again. In my case, this was an
svn command. To fix this, take a guess…..yes! Re-install
$ brew install svn
And once that’s done, run the the composer install again and you should be fine.
Step 5: Test it out!
Start a new laravel project:
$ laravel new app
Test it out:
cd app && php artisan serve
Point your browser to
localhost:8000 and witness the magick :)
The Hasura platform helps you rapidly add backend APIs to your PHP-Laravel app and instantly deploy it to the cloud. Get started with it here: https://hasura.io