Installing Laravel Valet on MacOS Ventura
1. Install Xcode
Install Xcode Via the command line:
xcode-select –install
Or via the Apple Store
Some Docs for more reading: https://mac.install.guide/commandlinetools/4.html
2. Generate and add an SSH Key
Step-by-step:
ssh-keygen -t ed25519 -C "your_email@example.com"
pbcopy < ~/.ssh/id_ed25519.pub
touch ~/.ssh/config
nano ~/.ssh/config
(paste the following)
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
In NANO save it with ctrl + o, then ctrl + x and enter to exit
eval "$(ssh-agent -s)"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Github has great resources on this: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
Install Homebrew
Install with the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Read the brew docs at: https://brew.sh/
touch ~/.zprofile
nano ~/.zprofile
Paste the following into the file:
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/yourprofile/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
zsh
Brew will tell you exactly what commands need echoed in your zshell.
Verify the installation with:
brew doctor
Installing PHP
Installing PHP via Homebrew: PHP 7.4 is depreciated, we will need to install a brew tap: https://github.com/shivammathur/homebrew-php
brew tap shivammathur/php
brew install php@7.4
All the additinal versions of php can be installed, so you can switch them as needed. The comman below is a handy way to see what versions are available:
brew search php
brew install php@8.0
brew install php
Verify the installation: php -v
Installing Composer (PHP Dependency Manager)
curl -sS https://getcomposer.org/installer | php
mkdir -p /usr/local/bin
sudo mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer
which composer
Should echo this location:
/usr/local/bin/composer
Installing Laravel Valet
composer global require laravel/valet
valet install
mkdir valet && cd valet
valet park
If successful, you should see this output:
This directory has been added to Valet's paths.
Now we can add an unzipped WordPress install to that directory, and rename it to the TLD we want to use. For example, if we want to use the domain example.test, we would add the WordPress install to the valet directory, and rename it to example.
A domain extensions of .test will be added to the end automatically. So, if you want to use example.test, you would name the directory example.
MariaDB Server
Our SQL DB isn’t installed, so lets, do that next.
brew install mariadb
Starting the server: brew services start mariadb
Initial setup and securing the installation:
mysql_secure_installation
Verifying the installation: Connect using
mysql
With that command it will prompt you for your password, and you can use these commands to create datbaes and users:
create database DATABASE_NAME;
grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'localhost' identified by 'PASSWORD';
flush privileges;
exit;
NVM and Node.js
Installing NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
Replace v0.39.4 with the latest version from the NVM GitHub repository https://github.com/nvm-sh/nvm. Verifying the installation: command -v nvm
Installing Different Versions of Node.js Using NVM
Installation command:
nvm install --lts
nvm install
Switching between versions:
nvm use <version>
Setting a default version:
nvm alias default <version>
Verifying the installation:
node -v
Using Oh My ZSH
Oh My Zsh is an awesome tool to make aliases and other shortcuts to you terminal. I highly recommend this tool. My favorite theme is xiong-chiamiov-plus.
Read the docs here: https://ohmyz.sh/#install
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
To edit your terminal theme, edit the .zshrc file in your home directory.
ZSH_THEME="xiong-chiamiov-plus"
More themes here: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes