How to Install Directus on macOS
Directus is an open-source headless CMS that allows you to manage your content through a web-based admin panel or API. In this tutorial, we will guide you through the installation process for Directus on macOS.
Prerequisites
Before you begin, you should ensure that you have the following tools installed on your macOS system:
- Homebrew
- PHP 7.2 or higher
- Composer
- MySQL or Postgres
Steps
- Open the terminal on your macOS system and run the following command to install Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- After installing Homebrew, run the following commands to install PHP, Composer, and other dependencies:
brew install php composer openssl
brew install [email protected] # or any latest version of PHP
- Next, install the PHP extensions required by Directus:
sudo pecl install mongodb # use latest version available
- Once the extensions are installed, you can download Directus via Composer:
composer create-project directus/app myproject
- Next, navigate to your Directus project directory and configure your database settings. Copy the
.env.examplefile to.envusing the following command:
cp .env.example .env
In the
.envfile, replace theDB_HOSTandDB_DATABASEfields with the details of your MySQL or Postgres database server.After configuring the
.envfile, generate the Directus API by running the following command:
php vendor/bin/directus install:database
- Finally, start the Directus server using the following command:
php vendor/bin/directus start
Conclusion
In this tutorial, we have shown you how to install Directus on macOS using Homebrew, PHP, and Composer. With Directus installed, you can start managing your content using the admin panel or API. If you encounter any issues during the installation process, consult the Directus documentation or seek help from the Directus community.