Installing Solr 8 on macOS Ventura: A Guide for Drupal Engineers

SYS.LOG // 04/14/2023
#Solr #macOS #Search API #Drupal 10

When building enterprise Drupal platforms, maintaining parity between local development and production environments is critical. Often, the latest versions available via package managers like Homebrew (such as Solr 9) introduce breaking changes or schema incompatibilities with the current Drupal Search API ecosystem.

For developers needing Solr 8 compatibility on macOS 13 Ventura, this guide provides a structured, professional installation path.

The Compatibility Challenge

As of macOS Ventura, the default Homebrew package for Solr has moved to version 9.x. However, many enterprise Drupal deployments still rely on the Solr 8.x schema for stability. Running mismatched versions can lead to indexing errors and inconsistent search results.


Prerequisites

Before starting, ensure you have the following installed:

  1. Homebrew (The macOS package manager).
  2. Java 8 (Required for Solr 8 stability).

Step 1: Install Java 8 via Homebrew

Solr 8 has a strong dependency on Java 8. To avoid version conflicts, we use the adoptopenjdk tap:

brew install --cask adoptopenjdk/openjdk/adoptopenjdk8

Step 2: Configure JAVA_HOME

To ensure Solr uses the correct JVM, we must find and export the JAVA_HOME path.

Check the installation path:

/usr/libexec/java_home -v 1.8

Add the following to your shell profile (.zshrc or .bash_profile):

# Replace with the path found above
export JAVA_HOME="/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"
source ~/.zshrc

Step 3: Manual Installation of Solr 8

Since Homebrew prioritizes version 9, we will perform a manual installation to a dedicated /opt directory for better control.

  1. Download: Fetch the legacy binaries from the Apache Solr 8 Archive.
  2. Extract and Move:
    tar xzf solr-8.9.0.tgz
    sudo mv solr-8.9.0 /opt/solr

Step 4: Environment Path Integration

Add the Solr binary to your system’s PATH to allow global command access:

export PATH=$PATH:/opt/solr/bin
source ~/.zshrc

Step 5: Automating with a Launch Daemon

For a professional local setup, Solr should run as a background service that persists across reboots. We achieve this using a macOS plist configuration.

Create the LaunchAgent

Create ~/Library/LaunchAgents/org.apache.solr.plist with the following definition:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.apache.solr</string>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/solr/bin/solr</string>
        <string>start</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/opt/solr/logs/solr.log</string>
    <key>StandardOutPath</key>
    <string>/opt/solr/logs/solr.log</string>
    <key>WorkingDirectory</key>
    <string>/opt/solr</string>
</dict>
</plist>

Load the Service

launchctl load ~/Library/LaunchAgents/org.apache.solr.plist

Verification

Navigate to http://localhost:8983/solr/ to access the Solr Admin Dashboard. You now have a stable, automated Solr 8 environment ready for enterprise Drupal development.

Facing search performance issues? Optimization of Solr cores and search schemas is a critical part of my backend architecture services. Let’s connect to fine-tune your enterprise search infrastructure.

Comments