Install Homebrew as package manager for macOS:
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Update everything in Homebrew to recent version:
brew update
Install packages needed for development:
brew install \
php \
mariadb \
mailhog \
n \
fish \
fisher \
starship \
composer \
pv \
wp-cli
Install commonly used GUI applications (feel free to remove any you may not want/need):
brew install --cask \
firefox \
google-chrome \
1password \
iterm2 \
visual-studio-code \
ray \
fork \
sequel-ace \
vlc \
figma \
rectangle \
maccy \
font-fira-code-nerd-font
Open up iterm2 and adjust these settings:
- Make iterm2 Default Term
- Preferences ->
- General -> Window
- unselect "Native full screen windows"
- select "close windows when closing an app"
- Appearance ->
- Windows
- select "Hide scrollbars"
- Tabs
- unselect "Show tab bar in fullscreen"
- Dimming
- Unselect all dimming
- Windows
- Profiles -> Window
- Transparency: 30
- Style: Full Screen
- Screen: Main Screen
- Profiles -> Advanced
- Semantic History -> Open with editor ... -> VS Code
- General -> Window
- Open new split pane with current directory
- Natural Text Editing
- Bring it to fullscreen Command + Enters
- check the fish path with which fish. In the examples below it was located at:
/opt/homebrew/bin/fish
. On older Macs the path might differ. - Add fish to the know shells run the command: sudo sh -c 'echo /opt/homebrew/bin/fish >> /etc/shells'
- Restart your terminal
- Set fish as the default shell run the command:
chsh -s /opt/homebrew/bin/fish
- Restart your terminal and check if it launched with fish or not
- Add brew binaries in fish path run the command:
set -U fish_user_paths /opt/homebrew/bin/ $fish_user_paths
Add the following to your fish config file ~/.config/fish/config.fish:
# Composer
set PATH $HOME/.composer/vendor/bin $PATH
set PATH $HOME/.config/composer/vendor/bin $PATH
# N
set -gx N_PREFIX $HOME/.n;
set -gx PATH "$N_PREFIX/bin" $PATH;
# Starship
starship init fish | source
source ~/.config/fish/config.fish
Set the prompt to use a nice default:
starship preset nerd-font-symbols > ~/.config/starship.toml
To install valet run:
composer global require laravel/valet
Then run:
valet install
PHP Monitor (or phpmon) is a lightweight macOS utility app that runs on your Mac and displays the active PHP version in your status bar. It's tightly integrated with Laravel Valet, so you need to have it set up before you can use this app, but it makes switching PHP versions and managing Valet very easy.
To install via Homebrew, run:
brew tap nicoverbruggen/homebrew-cask
brew install --cask phpmon
sudo valet trust
Then to run this automatically when loggin in, go to System Preferences > Users & Groups and add PHP Monitor to login items.
Create file $HOMEBREW_PREFIX/etc/my.cnf.d/developer.cnf
and put the following config in it. This will improve database performance when working on large websites.
[server]
join_buffer_size = 256M
table_definition_cache = 10K
innodb_buffer_pool_size = 2G
innodb_log_file_size = 256M
; Only if you think you'll be doing advanced app debugging
; performance_schema = 1
After installation you can access the server without a password providing you run it as the superuser. Run the following and add your own root password. Use the default response to all other questions.
brew services restart mariadb
sudo mariadb-secure-installation
Our practice for development machines is to have a common user that can access all databases. In your terminal start a MySQL session.
Now create a new "orphans" user.
CREATE USER 'orphans'@'localhost' IDENTIFIED BY 'press';
GRANT ALL PRIVILEGES ON *.* TO 'orphans'@'localhost';
N should already be installed if you have got this far which is our node version manager of choice. To install the latest lts version run:
n lts
To start MailHog just enter the following command in your terminal:
brew services run mailhog
Set some defaults for GIT:
git config --global user.name "Brett Mason"
git config --global user.email "[email protected]"
git config --global init.defaultBranch main
I love the dracula theme and recommend everyone use it as its available for most things. Specifically for this setup, instructions for: