Aman Srivastava

Full Stack Development Practitioner

Drupal Development on MacOS

I’ve made the deliberate choice to shift away from using containers on my Apple M1 machine for local development, and instead, I’ve embraced Laravel Valet. The decision was driven by several key factors that have greatly improved my development workflow. Firstly, the Apple M1 architecture posed compatibility challenges with some containerization solutions, which led to performance issues and occasional system instability. Secondly, Laravel Valet’s simplicity and ease of setup have streamlined my local development environment, allowing me to focus more on coding and less on managing containers and configurations. Additionally, Valet’s native support for PHP, Nginx, and MySQL has proven to be incredibly efficient, resulting in faster load times and overall improved productivity. This transition has been a game-changer for my development process, enabling me to work more efficiently and effectively on my M1-powered Mac.

How to Install Valet?

Installing Laravel Valet on your macOS system is relatively straightforward, but it does require some prerequisites. Here are the steps to install Laravel Valet:


  1. macOS with Homebrew installed (
  2. PHP installed (you can use Homebrew for this)
  3. Composer installed (
  4. MySQL or another database system installed (optional, depending on your project requirements)

Installation Steps:

  1. Install Homebrew: If you haven’t already, install Homebrew by opening Terminal and running this command:

    /bin/bash -c "$(curl -fsSL"
  2. Install PHP: Laravel Valet requires PHP. You can install it using Homebrew:

    brew install php
  3. Install Composer: If you haven’t already installed Composer, you can do so by running this command:

    brew install composer
  4. Install Valet: Use Composer to install Laravel Valet globally:

    composer global require laravel/valet
  5. Add Composer Global Bin Directory to Your Path: Laravel Valet’s executable files are located in Composer’s global bin directory. To make them accessible from anywhere in your terminal, add this directory to your PATH. Add the following line to your shell profile file (usually ~/.zshrc or ~/.bashrc):

    export PATH="$PATH:$HOME/.composer/vendor/bin"
  6. Install Valet: Run this command to install Valet and start its services:

    valet install
  7. Park a Domain: Choose a domain to use for your development projects. For example, let’s use .test. To park a domain, run:

    valet domain test
  8. Install MySQL with Homebrew:

    brew install mysql
  9. Start MySQL Server:

    brew services start mysql

    This command will start the MySQL server and ensure that it launches automatically at system startup.
  10. Secure MySQL Installation:
    After installation, you should run the MySQL security script to improve the default security settings:


    Follow the prompts to set a root password, remove anonymous users, disallow remote root login, and remove the test database.
  11. Access MySQL Console: You can access the MySQL console with the following command:

    mysql -u root -p

    Enter the root password you set during the secure installation process.
  12. Create Databases for Your Drupal Projects: In MySQL, create separate databases for each of your Drupal projects. You can do this from the MySQL console or use a tool like Sequel Pro if you prefer a graphical interface.
    Mysql query to create Database by name drupal10.

    create schema drupal10;

    I’m using this for local development, so I use the root user while configuring the Drupal instead of creating the specific database user and assigning the permissions to the database.
  13. Create a New Directory for Your Drupal Projects: Create a directory where you’ll store all your Drupal projects. For example, you can create a “drupal-projects” folder in your home directory:

    mkdir ~/drupal-projects
  14. Navigate to the Drupal Projects Directory: Move to the directory where you want to create your Drupal projects:

    cd ~/drupal-projects
  15. Park the Drupal Project to Valet: Add current directory
    to Valet so all the applications within this directory will be accessible.

    valet park

    Now, any application you create within your “parked” directory will automatically be served using the http://<directory-name>.test
  16. Create a New Drupal Project: Use Composer to create a new Drupal project. Replace project-name with your desired project name:

    composer create-project drupal/recommended-project project-name
  17. Link the Drupal Project to Valet: Navigate to your new Drupal project’s directory:

    cd ~/drupal-projects/project-name
  18. Access Your Projects: You can now access your Drupal projects in your web browser using the domain you parked earlier. For example, if you parked .test, you can access a project at http://project-name.test.
  19. Connect with Database: Now you will the get install page where you can connect your Drupal with the database, using hostname: localhost, username: root, password: <configured in Step 10>, database_name: drupal10/<or whichever you created>.






Leave a Reply

Your email address will not be published. Required fields are marked *