The Neuronen Schmiede concerns itself with topics related to software development. One focus are robust web applications.

Laravel 4.2 Setup on OS X Yosemite

Permalink

To run Laravel 4.2 on a OS X Yosemite setup with the default PHP binary and Postgres as a database1 you have to follow a few steps. Make sure you have Homebrew installed before you start.

Laravel needs the MCrypt PHP extension and since we want to use Postgres we also have to install the PDO Postgres driver.

Check PHP version

php -v

Replace 55 within following commands with whatever version of PHP you are running.

Install MCrypt and the Postgres PDO driver

brew tap josegonzalez/php
brew install php55-mcrypt --without-homebrew-php
brew install php55-pdo-pgsql --without-homebrew-php

Now we have to tell PHP about the new extensions. These paths depend on your installation so make sure to lookup the correct paths for your machine.

Tell PHP about the newly installed extensions

sudo cp /etc/php.ini.default /etc/php.ini
sudo echo 'extension="/usr/local/Cellar/php55-mcrypt/5.5.20/mcrypt.so"' >> /etc/php.ini
sudo echo 'extension="/usr/local/Cellar/php55-pdo-pgsql/5.5.20/pdo_pgsql.so"' >> /etc/php.ini

The next step is installing Composer so we can install Laravel and its dependencies. When adding the composer binary to your PATH make sure to adapt the path.

Installing Composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
echo 'export PATH="/Users/david/.composer/vendor/bin:$PATH"' >> ~/.zshrc

Finally we can install Laravel itself and create a new project.

Installing Laravel and setting up a new project

composer global require "laravel/installer=~1.1"
laravel new my-new-project
  1. I usually have nothing to do with the PHP world so I don't want to install any versions of PHP, MySQL or other pieces of tooling that I don't use for my usual development tasks.