
How To Install Laravel Locally On A Mac
So You Can Install Survloop
I have only been learning Laravel for a year, but below is the Homestead install process which has worked best for me. Homestead is Laravel's own development environment, powered by Vagrant.
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 "your@emailaddress.com"
- Install Composer, Homestead, and initialize. For this example, the work area's directory is "~/web", and the project folder is installed to "ProjectName", but you can adjust those as needed:
$
vagrant box add laravel/homestead
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer $ mkdir ~/web $ cd ~/web $ git clone https://github.com/laravel/homestead.git ProjectName$
git checkout release
$ cd ProjectName $ bash init.sh - Edit paths in Homestead.yaml:
$ nano Homestead.yaml
Change the folders and sites to:folders: - map: ~/web/ProjectName/code to: /home/vagrant/code sites: - map: survloop.local to: /home/vagrant/code/ProjectName/public
- Edit the hosts file:
$ sudo nano /etc/hosts
Add one line to the bottom:192.168.10.10 homestead.local
- Launch your local server ("vagrant up"), log into it, and install Laravel!...
$ cd ~/web/ProjectName $ vagrant up $ vagrant ssh $ cd /home/vagrant/Code $ composer global require "laravel/installer" $ composer create-project laravel/laravel ProjectName "5.8.*"
Now you should be able to confirm your successful installation by pulling up http://homestead.local 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/ProjectName/code/ProjectName (that's within your main user account folder alongside Documents, Pictures, etc).
$ cd ProjectName
Edit the environment file to connect the database:
$ nano .env
DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret
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/rockhopsoft/survloop
Or anything else you can imagine: https://laravel.com/docs/5.8