AEM Start Script for Developers

Evgeniy Fitsner Software Engineer
2 min read
AEM Start Script for Developers

Introduction

Navigating to the crx-quickstart folder, cleaning logs, and setting JVM options every time you restart AEM is tedious. The scripts below automate this process for both Windows and macOS.

Place either script at the same directory level as license.properties.

Windows (start.bat)

1
2
3
4
5
6
7
8
del /s /q ".\crx-quickstart\logs\*.*"

set CQ_PORT=4502
set CQ_RUNMODE=author,localdev
set CQ_JVM_OPTS=-Xmx2048m -XX:+UseG1GC -XX:-UseGCOverheadLimit -Duser.language=en -Duser.region=US -Duser.timezone=UTC -Djava.awt.headless=true -Dfile.encoding=UTF-8 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001

cd ./crx-quickstart/bin
call ./start.bat

macOS (start.sh)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

echo "Clean AEM logs"
find crx-quickstart/logs/ -type f -delete

echo "Set AEM parameters"
export CQ_PORT="4502"
export CQ_DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001"
export CQ_LOCALE_OPTS="-Duser.language=en -Duser.region=US -Duser.timezone=UTC -Dfile.encoding=UTF-8"
export CQ_RUNMODE="author,nosamplecontent"
export CQ_JVM_OPTS="-Djava.awt.headless=true -Xmx2048m -XX:+UseG1GC -XX:-UseGCOverheadLimit $CQ_LOCALE_OPTS $CQ_DEBUG_OPTS"

echo "Start AEM instance"
crx-quickstart/bin/start "$@"

Configuration Notes

  • Memory: Adjust -Xmx2048m based on your available RAM. Larger projects may benefit from 4GB or more.
  • Debug port: The default debug port is 8001. Change it if you run multiple AEM instances.
  • Run mode: The Windows script uses author,localdev while macOS uses author,nosamplecontent. Adjust these to match your workflow.
  • Make the macOS script executable with chmod +x start.sh before running.

Contents