How To Install Laravel Locally On A MacSo You Can Install SurvLoop
Replace all references to "ProjectName" with a short name for your own project.
- Install XCode from the App Store. Open it, and accept the user agreement.
- Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Install Vagrant: https://www.vagrantup.com/downloads.html
- To the command line (Mac OS Terminal, or iTerm)! Create local ssh key, if you haven't on this computer before:
$ ssh-keygen -t rsa -C "firstname.lastname@example.org"
- Install Composer, Homestead, and initialize:
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer $ mkdir ~/web $ mkdir ~/web/sites $ mkdir ~/web/sites/ProjectName $ cd ~/web $ git clone https://github.com/laravel/homestead.git Homestead $ cd Homestead $ bash init.sh
- Edit paths in Homestead.yaml:
$ nano Homestead.yamlChange this chunk of code:
folders: - map: ~/code to: /home/vagrant/code sites: - map: homestead.app to: /home/vagrant/code/Laravel/publicTo this chunk of code:
folders: - map: ~/web/sites/ProjectName to: /home/vagrant/code sites: - map: homestead.app to: /home/vagrant/code/ProjectName/public
- Edit the hosts file:
$ sudo nano /etc/hostsAdd one line to the bottom:
- Launch your local server ("vagrant up"), log into it, and install Laravel!...
$ cd ~/web/Homestead $ vagrant up $ vagrant ssh $ cd /home/vagrant/Code $ composer global require "laravel/installer" $ composer create-project laravel/laravel ProjectName "5.6.*"
Now you should be able to confirm your successful installation by pulling up http://homestead.app/ in your browser!
- If you like, you can now connect to your server's database with something like Sequel Pro, and the following default login info.... Host: 127.0.0.1 , Username: homestead , Password: secret , Port: 33060 , Database: homestead .
And you're ready to start installing more Laravel packages and building your own world. Here, inside your virtual vagrant server via SSH, you can enter your new project's main composer directory (/home/vagrant/Code/ProjectName), which displays in your actual machine's file system in ~/web/sites/ProjectName/ProjectName (that's within your main user account folder alongside Documents, Pictures, etc).
$ cd ProjectName
You could do things like install Laravel's out-of-the-box user authentication tools:
$ php artisan make:auth
Or install the SurvLoop software I've started: https://packagist.org/packages/wikiworldorder/survloop
Or anything else you can imagine: https://laravel.com/docs/5.6