Installation
# Installing Nitro for macOS
- Install Docker Desktop Docker Desktop (opens new window) 3.0.0 or higher.
- Install Nitro by opening a terminal and running
bash <(curl -sLS http://installer.getnitro.sh)
Nitro does not support MySQL for Apple Silicon, but you can use MariaDB interchangeably.
# macOS via Brew
You can alternatively install Nitro using the Homebrew (opens new window) package manager if you have it installed.
- Install Docker Desktop:
brew install homebrew/cask/docker
- Install Nitro:
brew install craftcms/nitro/nitro
- Run
nitro init
and follow the prompts to initialize the Nitro environment.
# macOS Manual Installation
If you run into issues with either install method, you can manually install Nitro instead by adding the appropriate binary to your system:
- Install Docker Desktop Docker Desktop (opens new window) 3.0.0 or higher.
- Visit Nitro’s GitHub Releases (opens new window) page and download the archive for your system.
- Extract the release archive and make
nitro
executable withchmod +x ./nitro
. - Move the binary into your path with
sudo mv ./nitro /usr/local/bin
.If the
/usr/local/bin/
directory doesn’t exist, create it with
sudo mkdir -p -m 775 /usr/local/bin && sudo chown $USER: /usr/local/bin
. - Allow Nitro to be trusted by opening your terminal and either
- Running
nitro
, choosing Cancel for the security prompt, and visiting System Preferences → Security and Privacy → General to choose Allow Anyway next to the warning aboutnitro
being blocked. - Running the following to strip the quarantine flag macOS adds automatically:
xattr -dr com.apple.quarantine /usr/local/bin/nitro
- Running
- Run
nitro init
and follow the prompts to initialize the Nitro environment.
# Installing Nitro for Linux
- Install Docker Engine for your distro.
- Open a terminal and run
bash <(curl -sLS http://installer.getnitro.sh)
.
Make sure you follow instructions (opens new window) to add your user to the docker
group so you don’t need to run Docker using sudo
.
# Linux Manual Installation
- Visit Nitro’s GitHub Releases (opens new window) page and use the
nitro_linux_x86_64.tar.gz
bundle. - Extract the release archive and make the
nitro
executable withchmod +x ./nitro
. - If
/usr/local/bin
does not exist for you, create it withsudo mkdir -p -m 775 /usr/local/bin && sudo chown $USER: /usr/local/bin
. - Move the binary into your path with
sudo mv ./nitro /usr/local/bin
. - Run
nitro init
and follow the prompts to initialize the Nitro environment.
# Installing Nitro for Windows
Nitro 2 runs on Windows 10 Home or Pro and requires build 19042 or higher with WSL2.
- Install Docker Desktop (opens new window) 3.0.0 or higher, making sure Install required Windows components for WSL 2 is checked.
- Install WSL2 (opens new window).
- Install the WSL2 Linux kernel update package (opens new window).
- In Windows PowerShell, set the default WSL to version 2 using
wsl --set-default-version 2
. - Install a WSL2 compatible distro from the Microsoft Store. We recommend Ubuntu 20 (opens new window).
- In Docker Desktop, go to Settings → General and make sure Use the WSL 2 based engine is checked.
- In Docker Desktop, go to Settings → Resources → WSL Integration and make sure WSL is enabled for the distro you installed.
If your distro isn’t listed after choosing Refresh or restarting Docker Desktop, make sure it’s installed and upgraded to WSL v2. If running
wsl -l -v
lists your distro with a1
next to it, upgrade withwsl --set-version [distro name] 2
. - Open the WSL2 terminal. If you installed Ubuntu, for example, it will be listed as “Ubuntu” in the Start Menu.
- Verify Docker is running inside the distro by running
docker ps
. If Docker is not running you’ll get an error message, otherwise you should see a table for containers even though there aren’t any running yet:oli@ubuntu:~$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES oli@ubuntu:~$
- From the WSL terminal, run
bash <(curl -sLS http://installer.getnitro.sh)
.
# Windows Manual Installation
If you run into issues with the shell script installer, you can manually install Nitro:
- Visit Nitro’s GitHub Releases (opens new window) page and use the
nitro_linux_x86_64.tar.gz
inside your WSL2 instance. - Extract the release archive and make the
nitro
executable withchmod +x ./nitro
. - If
/usr/local/bin
does not exist for you, create it withsudo mkdir -p -m 775 /usr/local/bin && sudo chown $USER: /usr/local/bin
. - Move the binary into your path with
sudo mv ./nitro /usr/local/bin
. - Run
nitro init
and follow the prompts to initialize the Nitro environment.
# Troubleshooting
# I’ve installed Nitro but can’t access any sites in my browser.
Nitro should establish the Docker containers it needs and either edit or prompt for your help editing your machine’s hosts file so custom local domain names can be routed to those containers.
If you can’t access any sites you’ve created...
- Make sure your machine’s hosts file includes the
# <nitro>
+# </nitro>
lines with custom domains you’ve specified. - Use the
nitro ls
command or Docker Desktop to make sure you’ve got a container callednitro-proxy
and that it’s running. If it’s not, you may have something already running on a port it expects to use, which you can get around by customizing Nitro’s default ports.
# Uninstalling Nitro
To completely remove Nitro, first destroy its Docker networks, containers, and volumes:
nitro destroy
# macOS and Linux
Then remove your nitro
command:
sudo rm /usr/local/bin/nitro
You can optionally remove your Nitro config as well:
rm -rf ~/.nitro
# macOS via Brew
If you installed Nitro with brew
:
brew uninstall nitro
# Windows
Follow the uninstallation instructions for Linux inside your WSL2 box.