Skip to content

Instantly share code, notes, and snippets.

@ko31
Last active January 29, 2021 11:56
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ko31/4fc8cb7aa6613dc517362bd090d67994 to your computer and use it in GitHub Desktop.
Installing Laravel Homestead on MacOS πŸ”§

Laravel Homestead is official local development environment.
It is a great tool that allows you to easily create an environment with all the functions required for development.

The following is the steps for installing Laravel 6.x on MacOS with Homestead.

Install VirtualBox.

Install Vagrant.

Install the Homestead Vagrant box.

$ vagrant box add laravel/homestead

Install Homestead.

$ git clone https://github.com/laravel/homestead.git ~/Homestead

Create the Homestead configration file.

$ cd ~/Homestead
$ bash init.sh

Homestead.yaml is created in the directory.

$ cat Homestead.yaml
---
ip: "192.168.10.10"
memory: 2048
cpus: 2
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
      to: /home/vagrant/code

sites:
    - map: homestead.test
      to: /home/vagrant/code/public

databases:
    - homestead

features:
    - mariadb: false
    - ohmyzsh: false
    - webdriver: false

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

View the folders property of the Homestead.yaml file.

folders:
    - map: ~/code
      to: /home/vagrant/code

Create directory according to settings.

$ mkdir ~/code

Edit the sites property of the Homestead.yaml file. In the case, the project directory name is myproject.

sites:
    - map: homestead.test
      to: /home/vagrant/code/myproject/public

Add name resolution to hosts file.

$ sudo vi /etc/hosts

192.168.10.10 homestead.test

Launch Vagrant.

$ cd ~/Homestead
$ vagrant up

If there are not id_rsa (secret key) and id_rsa.pub (public key) in ~/.ssh directory, create key files.

$ ssh-keygen -t rsa

Connect to virtual machine using SSH.

$ vagrant ssh

Install Laravel with project name myproject.

$ cd ~/code
$ composer create-project --prefer-dist laravel/laravel myproject

View homestead.test in your browser.

Welcome to Laravel

Good Job!πŸ‘

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment