Note
Please note we no longer use MAMP for local development and have moved to DDEV.
Create Sites folder:
mkdir ~/Sites
You should clone all projects into this folder, using SSH to clone from GitHub since this uses SSH keys to authenticate with GitHub. As an example, to clone this repo you'd use:
git clone git@github.com:studio24/mac-setup.git
DDEV is a simple development environment which uses Docker to manage local development environments. It's mostly fully automated and allows us to configure software versions (e.g. PHP, MySQL) and store these in version control, so everyone uses the same version.
OrbStack is a fast and simple alternative to Docker Desktop. We have team licenses.
Please note if you have Docker Desktop already installed we recommend uninstalling this first.
Installation instructions:
- Login to the OrbStack website using your GitHub account
- Install the app via
brew install orbstack
- Open OrbStack to configure it
- Select Docker to use Docker containers
- Sign in to OrbStack to use the professional license (sign in button bottom-left or Account > Sign in)
- Open OrbStack Settings
- In General tick Automatically download updates
- If you want OrbStack to automatically start on login, tick Start at login
OrbStack should prompt when it needs updating (you'll need your Mac admin password to update software).
Note: to add a member to the Studio 24 Orbstack account admin users can go to the dashboard, select Studio 24 organisation > Settings > Members > Invite a member.
You must have Docker installed locally first (OrbStack).
To install DDEV, run:
brew install ddev/ddev/ddev
The first time you use DDEV it will ask:
May we send anonymous DDEV usage statistics and errors?
Answer no.
brew upgrade ddev/ddev/ddev
To start DDEV run:
ddev start
To view the website in your default browser:
ddev launch
To list all current projects:
ddev list
To restart DDEV (for example if config has changed) run:
ddev restart
To stop DDEV run
ddev stop
You can also shut down all DDEV projects via:
ddev poweroff
By default all emails sent from your website are captured in a tool called Mailpit, which allows you to review emails sent by the website.
To open Mailpit run:
ddev mailpit
To access the database via TablePlus:
ddev tableplus
Import a database via an SQL file:
ddev import-db < [filename]
Export SQL files for a database:
ddev export-db
Xdebug comes with it by default. To enable Xdebug run:
ddev xdebug on
To disable Xdebug:
ddev xdebug off
To toggle Xdebug on and off:
ddev xdebug toggle
Read instructions on how to setup Xdebug in PHPstorm and VSCode.
All commands must be run via ddev to ensure you are using the correct version of PHP. For example:
ddev composer install
Some useful commands from the DDEV docs:
ddev composer
gives access to Composerddev artisan
(Laravel only) gives direct access to the Laravel artisan CLIddev console
(Symfony only) gives access to the Symfony console CLIddev craft
(Craft CMS only) gives access to the Craft CLIddev npm
gives direct access to the npm CLIddev wp
(WordPress) give direct access to the WP CLIddev ssh
takes you into the web containerddev exec [command]
executes a command inside the web container