If you’re reading this, chances are you are already in love with laravel, you probably have seen a couple of advantages laravel has over other frameworks, seen a tutorial video or read an article that has sparked your interest in laravel. However, loving laravel is one thing, installing it is another.
I personally got acquainted with laravel just before version 5 was released, but somehow I kept postponing diving into it, sadly, at the time I decided to, laravel 5 had been released and most of the instructions I found online for installation where either for a none XAMPP user or for version 4 for a XAMPP user and this was a pain!
So you don’t go spend so much time looking for a solution like I did, I’ve decided to be your knight in shinny armor, here’s how to install Laravel 5 on XAMMP for Mac OS X.
Requirements
- Terminal
- XAMPP
OSX by default has PHP pre-installed, so when you install XAMPP, you’ll actually be installing a second PHP version on your MAC. Your Computer decides which to use depending on if internet sharing is on (System preferences/sharing) or if xampp server is on and apache is started. To know which version of PHP you system is using by default, open terminal, run “which php” without the quotes.
If what you get IS NOT “/Applications/XAMPP/xamppfiles/bin/php”, here’s how to correct it
Create a file called .bash_profile on your home directory (if you don’t have this file already) from terminal, to do this run the following commands one line at a time
Cd /
Sudo nano .bash_profile
Then add this to the file:
export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH
Then hold “Control X” when prompted to save type y and press enter
Then quit and relaunch Terminal.app.
To confirm if this has worked, run “which php” from terminal without the quotes, you should get this “/Applications/XAMPP/xamppfiles/bin/php”
Next step is to install composer, to do this, navigate to your XAMPP public folder from terminal (htdocs), to do this, type
cd /Applications/XAMPP/htdocs
to confirm you’re in the right place, type “ls” and hit enter without the quotes, compare the directory listing with the contents of the actual htdocs folder from finder, if they are the same, you’re on track.
To download and install composer type
“curl -s http://getcomposer.org/installer | php”
and hit enter without the quotes, composer will download and install
Now you can install laravel, to do this type the following without the quotes and hit enter
“composer create-project laravel/laravel --prefer-dist
”
This will download and install the latest version of laravel on your htdocs folder, however, if you visit http://localhost/laravel/public you’ll find a blank screen, don’t panic, its just a folder permission issue. To fix this, in terminal type the following and hit enter
Cd /Applications/XAMPP/htdocs/laravel
After that, type the following ad hit enter
sudo chmod -R 7777 storage
try opening http://localhost/laravel/public again, you should now see the default laravel page.
If this didn’t work for you, leave a comment and I’ll get back to you as soon as I can!