Run ClickHouse database as a service on macOS with standard Homebrew commands:
- Install clickhouse:
brew install --cask clickhouse
- Install clickhouse service wrapper:
# Add this tap
brew tap pavsap/clickhouse
# Install server wrapper
brew install clickhouse-server
# Basic service control
brew services start|stop|restart clickhouse-server
# Check service status
brew services info clickhouse-server
# Manual start (without service)
clickhouse server --config-file=/opt/homebrew/etc/clickhouse-server/config.xml
# Test local queries
clickhouse client -q 'SELECT 1'
clickhouse client -q 'SELECT version()'
# Test connectivity
curl 'http://localhost:8123/ping'
curl 'http://localhost:8123/?query=SELECT%201'
Default configuration files are located at:
/opt/homebrew/etc/clickhouse-server/config.xml
/opt/homebrew/etc/clickhouse-server/users.xml
Data directory:
/opt/homebrew/var/lib/clickhouse
Log files:
/opt/homebrew/var/log/clickhouse-server/clickhouse-server.log
/opt/homebrew/var/log/clickhouse-server/clickhouse-server.err.log
Default configuration:
- Empty password for default user
- Access restricted to localhost (127.0.0.1 and ::1)
- Default ports:
- HTTP: 8123
- Native: 9000
- Interserver: 9009
Configuration files are not overwritten on upgrade. To use new configurations:
- Backup existing files
- Remove them
- Reinstall the formula
- Binary not found:
brew reinstall --cask clickhouse
brew reinstall clickhouse-server
- Permission issues:
sudo chown -R $(whoami) /opt/homebrew/var/lib/clickhouse
sudo chown -R $(whoami) /opt/homebrew/var/log/clickhouse-server
- Port conflicts: Edit ports in config.xml and restart the service.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.