Installing Laravel On OSX (Mavericks)

Laravel-MacbookSome people might think i have too much time on my hand and thus I like writing posts like this. Others might think I’m doing all of this just to help others. However, I mostly write these posts for myself, so I don’t have to go through the excruciating pain again.

Installing Laravel on my Macbook with Mavericks installed seemed to be a one hour job at the most but turned out to be a process taking much more time than I cared too.

So here it goes, more after the break.

Installing MCrypt for PHP on Mac

To not contribute to some serious Internet pollution, for this I’m gonna refer to the instructions in a post on The Coolest Guide On The Planet. Laravel need MCrypt to be installed so just follow the steps in the post and you’ll be fine.

Configuring Apache

Mavericks ships with PHP 5.4 which has its own build in webserver, but I prefer Apache also because I want to use multiple hosts and maybe some other advanced features. Apple have removed the “Web Sharing” feature from System Preferences, but Apache is still installed. We just have to use the command line now to start and stop it.

First we need to make sure root has write permission for config file:

Now edit the httpd.conf file:

Find AllowOverride None within the <directory “=”” library=”” webserver=”” documents”=””> (use ctrl+w to search) and and change to AllowOverride All so that .htaccess files will work. Next ctrl+o to save.

Next set the right permissions and restart Apache:

Basically this already put Apache in operation, just open your browser and navigate to http://127.0.0.1, you should get a page with the catchy text “It works!”. If not clearly it doesn’t work since clearly you did something wrong.

Just one more thing you want to do, change the permission on php.ini so you can edit it:

Installing Composer

Next you need to install composer. There are several ways of doing that on your Mac, I picked this method:

Easy lah.

Installing Laravel

So when you did all the previous steps, this should be fairly easy:

This will create a fresh install of Laravel in a folder with the name . One thing you need to do in order for Laravel to work, you (may) need to grant the web server write permissions to the app/storage directories.

So now Laravel is working but you still want to create a virtual host or just change the root folder of Apache:

Now find the line:

And change it to:

Restart Apache sudo apachectl restart and next check whether Laravel is working by browsing to http://127.0.0.1 in your browser, You should see the Laravel logo with the text “You have arrived” as featured in this post.

That’s it.

Comments are closed.