Install Cassandra on macOS
Easy installation with Homebrew or manual setup - perfect for development!
🍎 macOS: Great for Development!
✅ Why macOS is Good for Cassandra
- ✅ Unix-based: Same command-line tools as Linux
- ✅ Homebrew: Super easy installation (1 command!)
- ✅ Better than Windows: Native Unix environment
- ✅ Developer friendly: Excellent for learning and building apps
- ✅ Works on M1/M2/M3: Apple Silicon support
⚠️ Still: Not for Production
While better than Windows, macOS is still NOT recommended for production:
- ⚠️ Performance: 10-20% slower than Linux
- ⚠️ macOS servers rare: Most production runs Linux
- ⚠️ License costs: macOS Server discontinued
💡 Best Use Cases
- ✅ Learning Cassandra: Perfect for tutorials
- ✅ Local development: Building macOS/iOS apps
- ✅ Testing queries: CQL practice
- ✅ Prototyping: Quick proof-of-concepts
- 🐳 For production testing: Use Docker or Linux VM
🚀 Let's install Cassandra on your Mac!
🎯 Choose Your Installation Method
Two options: Easy Homebrew or Manual installation.
Homebrew Method
Recommended for most users!
- ✅ Super easy: 3 commands!
- ✅ Auto-updates:
brew upgrade - ✅ Dependencies handled: Java installed automatically
- ✅ Service management: Start/stop easily
- ✅ Clean uninstall:
brew uninstall
Manual Installation
For advanced users
- ⚙️ More control: Choose versions
- ⚙️ Multiple versions: Run different Cassandra versions
- ⚙️ Custom configs: Full control
- ❌ More work: Manual updates
- ❌ Manual cleanup: No package manager
Not Sure Which to Choose?
Choose Homebrew if:
- You're new to Cassandra
- You want the easiest installation
- You already use Homebrew for other tools
Choose Manual if:
- You need a specific Cassandra version
- You want to run multiple versions
- You prefer full control over installation
🍺 Method 1: Homebrew Installation (Recommended)
The easiest way to install Cassandra on macOS!
Install Homebrew (if not installed)
First, check if you have Homebrew:
If not installed, install Homebrew:
Install Java (OpenJDK 11)
Cassandra needs Java. Install via Homebrew:
Install Cassandra with Homebrew
Now install Cassandra (this installs everything automatically!):
Wait for installation to complete (2-3 minutes).
Start Cassandra Service
Start Cassandra as a background service:
First startup takes 30-60 seconds! Be patient.
Verify Installation
Test that Cassandra is working:
Homebrew Installation Complete! 🎉
Useful Homebrew commands:
brew services start cassandra- Start Cassandrabrew services stop cassandra- Stop Cassandrabrew services restart cassandra- Restart Cassandrabrew upgrade cassandra- Update to latest versionbrew uninstall cassandra- Remove Cassandra
Configuration file location:
/opt/homebrew/etc/cassandra/cassandra.yaml
Data directory:
/opt/homebrew/var/lib/cassandra
Logs:
/opt/homebrew/var/log/cassandra
M1/M2/M3 Mac Users (Apple Silicon)
If you have an Apple Silicon Mac, paths might be different:
- Homebrew location:
/opt/homebrew/(not/usr/local/) - Java location:
/opt/homebrew/opt/openjdk@11/ - Everything else works the same!
📦 Method 2: Manual Installation
For users who want more control over the installation.
Install Java Manually
Download and install OpenJDK 11:
Download Cassandra
Set Environment Variables
Add Cassandra to your PATH. Edit ~/.zshrc (or ~/.bash_profile):
Create Data Directories
Configure cassandra.yaml
Edit the configuration file:
Start Cassandra
⚙️ Configuration Tips
Optional: Optimize Cassandra for your Mac.
Adjust JVM Heap Size
For Macs with 8GB+ RAM, you can increase heap size:
macOS Resource Limits
macOS has strict resource limits. If you encounter errors, increase them:
✅ Verify Installation
Test that everything works correctly!
Check Cassandra Status
Connect with cqlsh
Run Test Queries
Installation Successful! 🎉
You now have Cassandra running on macOS!
- ✅ Cassandra server running
- ✅ cqlsh working
- ✅ Can create keyspaces and tables
- ✅ Ready to build applications!
🔧 Common Issues & Solutions
Fix common macOS installation problems!
❌ "command not found: cqlsh"
Problem: PATH not set correctly
Solution:
❌ "Cannot allocate memory" or OutOfMemory errors
Problem: JVM heap too large for your Mac
Solution:
❌ "Address already in use (port 9042 or 7000)"
Problem: Another Cassandra instance running
Solution:
❌ Cassandra starts but crashes immediately
Possible causes:
- Wrong Java version: Must be Java 11 or 17
- Corrupt data: Delete data directory
- Permission issues: Check directory ownership
Check logs:
❌ "Too many open files" error
Problem: macOS file descriptor limit
Solution:
❌ Python/cqlsh issues on M1/M2/M3 Macs
Problem: Python compatibility with Apple Silicon
Solution:
Still Having Problems?
Reset and start fresh:
🎉 What's Next?
Congratulations! You've successfully installed Cassandra on macOS!
🚀 Continue Your Learning:
- 📖 Learn CQL: Start with CQL Introduction
- 🔑 Create keyspaces: Keyspaces Guide
- 📊 Design tables: Data Modeling
- ⚡ Query data: SELECT Guide
💡 Useful Commands:
🍎 macOS Tips:
- 🔋 Battery life: Stop Cassandra when not using (
brew services stop cassandra) - 💾 Backups: Data in
/opt/homebrew/var/lib/cassandra - 🐳 For production testing: Use Docker or Linux VM
- ⚡ Performance: macOS 10-20% slower than Linux
🎓 Ready to build amazing applications with Cassandra!
Responsive Ad