Install PlantUML and Java on Mac
✅ PART 1: Install Java
🔹 Step 1: Check Java
java -version
🔹 Step 2: Install Java
Option A (Homebrew):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install openjdk
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ~/.zprofile
source ~/.zprofile
Option B (Oracle Installer):
Download from Oracle Java Downloads
🔹 Step 3: Verify
java -version
✅ PART 2: Install PlantUML
🔹 Step 1: Install Graphviz
brew install graphviz
🔹 Step 2: Install PlantUML
Option A: Download plantuml.jar
from plantuml.com/download
Option B: Homebrew install:
brew install plantuml
✅ PART 3: Run PlantUML
🔹 Option A: Using JAR
java -jar ~/tools/plantuml/plantuml.jar test.puml
🔹 Option B: Using Homebrew version
plantuml test.puml
🔹 Option C: IDE Integration
Use PlantUML plugin for VS Code or IntelliJ, set path to plantuml.jar
if needed.
✅ PART 4: Optional Alias
echo 'alias puml="java -jar ~/tools/plantuml/plantuml.jar"' >> ~/.zprofile
source ~/.zprofile
🧠Troubleshooting
Problem | Fix |
---|---|
java: command not found | Install Java, check PATH |
Error: Could not find or load main class | Check JAR file path |
Diagrams not rendering | Ensure Graphviz is installed (dot -V ) |
🎯 Summary
Task | Command / Action |
---|---|
Install Homebrew | See Part 1 Step 2 |
Install Java | brew install openjdk |
Install Graphviz | brew install graphviz |
Install PlantUML | brew install plantuml |
Download JAR | plantuml.com/download |
Run UML (JAR) | java -jar path/to/plantuml.jar file.puml |
Run UML (brew) | plantuml file.puml |