Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Jose Otero
Jose Otero
2,518 Points

Step-by-Step installation of Laravel Homestead

So, I know that these forums are for asking questions but I wanted to shared with everyone how I installed Laravel Homestead on Mac OSX (Yosemite 10.10). This is a very clear step-by-step explanation which took me exactly 5 days to figure out. So here you go (Side note, do not type the quotations for terminal commands):

1) Download Virtual Box (https://www.virtualbox.org/wiki/Downloads)

2) Download Vagrant (http://www.vagrantup.com/downloads.html)

3) Install both Virtual Box and Vagrant

4) open TERMINAL

5) Test that Vagrant is installed properly, type:

        "vagrant -v"

if you get "Vagrant #.#.#" followed by a version number you are   set.

6) type "clear"

7) type: "vagrant box add laravel/homestead"

8) IF MCRYPT ERROR OCCURS FOLLOW THE FOLLOWING STEPS: CONFIGURATION SETUP; TYPE:

    a) xcode-select --install

    b) cd ~ ; mkdir mcrypt ; cd mcrypt

    c) download: libmcrypt 2.5.8        
        (http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download)

    d) download: php code 5.5.14 
        (http://php.net/releases/index.php)

    e) put both downloaded items inside of the mcrypt directory which is in the root of the machine.

    f) cd ~/mcrypt

    g) tar -zxvf libmcrypt-2.5.8.tar.gz

    h) tar -zxvf php-5.5.9.tar.gz

    i) rm *.gz

    j) "cd libmcrypt-2.5.8

    k) ./configure

    l) make

    m) sudo make install

    n) cd ~/mcrypt

    o) curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz

    p) tar xvfz autoconf-latest.tar.gz

    q) cd autoconf-2.69/

    r) ./configure

    s) make

    t) sudo make install

    u) cd ../php-5.5.14/etc/mcrypt/

    v) /usr/bin/phpize

        EXPECT AN OUTPUT OF:

            Configuring for:
                PHP Api Version: 20121113
                Zend Module Api No: 20121212
                Zend Extension Api No: 220121212

    w) ./configure

    x) make

    y) sudo make install

PHP INI SETUP & CONFIGURATION:

    a) sudo cp /etc/php.ini.default /etc/php.ini

    b) sudo chmod u+w  /etc/php.ini

    c) sudo nano /etc/php.ini
        NOTE: scroll to where you see extensions = (a list of them)

    d) add this extension: 
        extension=mcrypt.so

    e) sudo apachectl restart

9) open .bash_profile (sudo nano) and add:

################################
# Adding Homestead PATH
################################

export HOMESTEAD_PATH=~/.composer/vendor/bin
export PATH=$HOMESTEAD_PATH:$PATH

10) in terminal run: composer global require "laravel/homestead=~2.0"

11) test homestead command with: homestead

12) run command: homestead init

13) Generate SSH key and files, run command: ssh-keygen -t rsa -C "your@email.com"

14) edit homestead yaml with command: homestead edit

15) MAKE REFERENCE TO NOTE AT TOP ABOUT PROJECT LOCATION, INSIDE OF YOUR HOMESTEAD.YAML YOU WILL PUT THAT PATH INFORMATION THERE.

16) open HOSTS file: sudo vi /etc/hosts

17) add the following: 127.0.0.1 (domain name specified in the homestead.yaml file) 192.168.10.10 (domain name specified in the homestead.yaml file)

18) Change directory to your project location as specified in the homest.yaml file.

19) CREATING PROJECT FILES (I use a lot of sub-folders so if you are like me, make sure to cd to that exact location you want to create your laravel project):

sudo composer create-project laravel/laravel (here put the name of the folder you want) --prefer-dist

20) while still inside project location but not inside the main folder, run command: sudo chmod -R 777 (name of the project folder)

21) run command: vagrant global-status

22) get the id of the virtual machine running

23) run command: vagrant reload --provision ##id of virtual machine here##

24) Test on web browser, if you see laravel welcome image, you are ready to develop. example: http://laravel.dev:8000

I think.. because you've set homestead in your path, you should simply be able to use:

homestead provision

homestead up

instead of finding the virtual machine id on numbers 21 - 23!

I'm also super surprised you had to go through all the mcrypt stuff.. that makes me sad because it's a bugger to get up and running. Great share!