How to Set Up Don’t Starve Dedicated Servers on Mac?
This comprehensive guide walks you through establishing a robust Don’t Starve dedicated server on Mac OS, with special considerations for Hong Kong hosting environments. Our optimized configuration ensures minimal latency for Asia-Pacific players while maintaining exceptional stability.
This guide covers complete server setup, performance optimization, mod management, and maintenance procedures. Expected setup time: 30-45 minutes.
Key benefits of Hong Kong hosting:
- Reduced latency for Asia-Pacific players (20-60ms)
- Improved connection stability for regional gaming
- Optimized routing for mainland China access
System Requirements and Preparation
Before proceeding with the server setup, verify that your Mac meets these critical specifications:
- Operating System: macOS 10.15 (Catalina) or newer
- Memory: 4GB RAM minimum (8GB recommended for modded servers)
- Storage: 20GB available space (SSD recommended for better performance)
- Network: Stable internet connection with minimum 10Mbps upload speed
- Steam Account: Active account with Don’t Starve ownership
- Technical Skills: Basic familiarity with Terminal commands
- Backup any existing game data before proceeding
- Close all running instances of Don’t Starve
- Ensure Terminal has Full Disk Access (System Preferences → Security & Privacy → Privacy)
- Check your firewall settings to allow incoming connections
Pre-Installation Checklist
- ✓ Verify system meets minimum requirements
- ✓ Install latest macOS updates
- ✓ Check available disk space
- ✓ Test internet connection speed
- ✓ Configure firewall settings
- ✓ Verify Steam account access
SteamCMD Installation Process
Follow these steps to install SteamCMD, the command-line version of Steam that we’ll use to download and update the server files.
mkdir ~/steamcmd
cd ~/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz" | tar zxvf -
chmod +x steamcmd.sh
After running these commands, verify the installation by checking for these files:
- steamcmd.sh (executable)
- package/steam_cmd_osx
- package/config.vdf
Server Installation and Configuration
# Launch SteamCMD
./steamcmd.sh
# Execute these commands within SteamCMD
login anonymous
force_install_dir ./ds_server
app_update 343050 validate
quit
Server Settings Configuration
Create and configure the necessary server directories and settings files.
cd ~/steamcmd/ds_server/data
mkdir -p ~/.klei/DoNotStarve
mkdir -p ~/.klei/DoNotStarve/MyCluster/Master
Create a new configuration file named ‘cluster.ini’ in your cluster directory with these optimized settings:
[GAMEPLAY]
game_mode = endless
max_players = 6
pvp = false
pause_when_empty = true
vote_enabled = true
[NETWORK]
cluster_name = Hong Kong DS Server
cluster_description = Optimized for Asia-Pacific Players
cluster_password = yourpassword
cluster_language = en
autosaver_enabled = true
tick_rate = 15
connection_timeout = 8000
[STEAM]
steam_group_only = false
steam_group_id = 0
steam_group_admins = false
[MISC]
console_enabled = true
max_snapshots = 6
[SHARD]
shard_enabled = true
bind_ip = 127.0.0.1
master_ip = 127.0.0.1
master_port = 10888
cluster_key = yourclusterkey123
Remember to change these default values:
- cluster_password: Set a strong server password
- cluster_key: Generate a unique cluster key
- bind_ip: Change to your server’s IP if hosting publicly
Server Launch Configuration
Create a launch script to start your server with optimal parameters.
#!/bin/bash
cd ~/steamcmd/ds_server/bin
# Set environment variables
export FPS=30
export PROMETHEUS_METRICS=1
# Launch server with optimal flags
./dontstarve_dedicated_server_nullrenderer \
-console \
-cluster MyCluster \
-shard Master \
-monitor_parent_process $$ \
-backup_logs \
-persistent_storage_root ~/.klei
Make the script executable and set proper permissions:
chmod +x start_server.sh
chmod -R 755 ~/.klei/DoNotStarve
Network Configuration
Configure your network settings for optimal performance, especially important for Hong Kong hosting.
# Add to your router/firewall configuration
TCP: 10999 (Game port)
UDP: 10999 (Game port)
TCP: 8768 (Steam authentication)
TCP: 27016 (Master server port)
UDP: 27016 (Master server port)
Performance Optimization for Hong Kong Hosting
Implement these specialized optimizations to enhance server performance for Asia-Pacific players.
# Add to /etc/sysctl.conf for optimal network performance
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_slow_start_after_idle = 0
net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 87380 16777216
- Configure CDN settings for faster asset delivery
- Use Hong Kong-based DNS servers for lower latency
- Implement proper TCP congestion control
- Enable BBR congestion control if available
Memory and CPU Optimization
# Create a resource management script (resource_manager.sh)
#!/bin/bash
# Set process priority
sudo renice -n -5 -p $(pgrep -f dontstarve_dedicated_server)
# Set CPU affinity (if multiple cores available)
taskset -pc 0-3 $(pgrep -f dontstarve_dedicated_server)
# Limit memory usage
ulimit -v 8388608 # Limit virtual memory to 8GB
Mod Integration and Management
Properly configure and manage server mods for optimal performance.
-- ~/.klei/DoNotStarve/MyCluster/Master/modoverrides.lua
return {
-- Example mod configuration
["workshop-462434129"]={ -- Server API Gems
configuration_options = {
["Restart_Interval"] = 0,
["Auto_Restart"] = true,
["Backup_Interval"] = 120
},
enabled = true
},
["workshop-378160973"]={ -- Global Positions
configuration_options = {
SHOWPLAYERSOPTIONS = 1,
FIREOPTIONS = 1,
OVERRIDEMODE = false,
SHAREMINIMAPPROGRESS = true
},
enabled = true
}
}
- Limit total mods to maintain server stability
- Test mods individually before deployment
- Monitor mod impact on server performance
- Keep mods updated to latest versions
Performance Monitoring Tools
#!/bin/bash
# Server monitoring script
while true; do
echo "=== Server Status Check $(date) ==="
# Check CPU usage
ps aux | grep dontstarve_dedicated_server | grep -v grep
# Check memory usage
memory_usage=$(ps -o rss= -p $(pgrep -f dontstarve_dedicated_server))
echo "Memory Usage: $((memory_usage/1024)) MB"
# Check network connections
netstat -tunap 2>/dev/null | grep dontstarve_dedicated_server
# Check disk space
df -h ~/.klei/DoNotStarve
# Log results
echo "----------------------------"
sleep 300 # Check every 5 minutes
done
Advanced Performance Tuning
#!/bin/bash
# Optimize disk I/O
sudo blockdev --setra 4096 /dev/sda
# Configure TCP BBR
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
# Optimize network buffers
echo "net.core.rmem_max=16777216" | sudo tee -a /etc/sysctl.conf
echo "net.core.wmem_max=16777216" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_rmem=4096 87380 16777216" | sudo tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_wmem=4096 87380 16777216" | sudo tee -a /etc/sysctl.conf
# Apply changes
sudo sysctl -p
- Server Response Time: < 100ms target
- CPU Usage: < 80% sustained
- Memory Usage: < 6GB for modded server
- Network Latency: < 150ms for AP region
- Disk I/O: Monitor for bottlenecks
Server Maintenance and Backup Systems
#!/bin/bash
# Configuration
BACKUP_DIR="$HOME/ds_backups"
SERVER_DIR="$HOME/.klei/DoNotStarve"
MAX_BACKUPS=5
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
# Create backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Create backup
tar -czf "$BACKUP_DIR/backup_$TIMESTAMP.tar.gz" -C "$SERVER_DIR" .
# Rotate old backups
ls -t "$BACKUP_DIR"/backup_*.tar.gz | tail -n +$((MAX_BACKUPS + 1)) | xargs -r rm
# Log backup completion
echo "Backup completed: backup_$TIMESTAMP.tar.gz" >> "$BACKUP_DIR/backup.log"
Automated Maintenance Schedule
#!/bin/bash
# Configuration
LOG_FILE="$HOME/ds_maintenance.log"
NOTIFICATION_EMAIL="admin@example.com"
log_message() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"
}
perform_maintenance() {
log_message "Starting maintenance routine"
# Stop server gracefully
./stop_server.sh
sleep 30
# Backup server files
./backup_system.sh
# Update server files
cd ~/steamcmd
./steamcmd.sh +login anonymous +force_install_dir ./ds_server +app_update 343050 validate +quit
# Clean old logs
find ~/.klei/DoNotStarve -name "*.log" -mtime +7 -delete
# Restart server
./start_server.sh
log_message "Maintenance completed"
}
# Run maintenance
perform_maintenance 2>&1 | tee -a "$LOG_FILE"
Monitoring and Alert System
#!/bin/bash
# Configuration
ALERT_THRESHOLD_CPU=80
ALERT_THRESHOLD_MEM=90
ALERT_THRESHOLD_DISK=85
check_server_health() {
# Check CPU usage
CPU_USAGE=$(ps aux | grep dontstarve_dedicated_server | grep -v grep | awk '{print $3}')
# Check memory usage
MEM_USAGE=$(free | grep Mem | awk '{print $3/$2 * 100.0}')
# Check disk usage
DISK_USAGE=$(df -h ~/.klei/DoNotStarve | tail -1 | awk '{print $5}' | sed 's/%//')
# Alert if thresholds exceeded
if (( $(echo "$CPU_USAGE > $ALERT_THRESHOLD_CPU" | bc -l) )); then
send_alert "CPU usage critical: ${CPU_USAGE}%"
fi
if (( $(echo "$MEM_USAGE > $ALERT_THRESHOLD_MEM" | bc -l) )); then
send_alert "Memory usage critical: ${MEM_USAGE}%"
fi
if [ "$DISK_USAGE" -gt "$ALERT_THRESHOLD_DISK" ]; then
send_alert "Disk usage critical: ${DISK_USAGE}%"
fi
}
send_alert() {
echo "[ALERT] $1" >> "$HOME/ds_alerts.log"
# Add your preferred alert method here (email, SMS, etc.)
}
Troubleshooting Guide
- Server Crashes:
# Check logs for errors tail -f ~/.klei/DoNotStarve/server_log.txt # Reset server files cd ~/steamcmd ./steamcmd.sh +login anonymous +force_install_dir ./ds_server +app_update 343050 validate +quit
- Performance Issues:
# Clear server cache rm -rf ~/.klei/DoNotStarve/cache/* # Reset world state rm -rf ~/.klei/DoNotStarve/MyCluster/Master/save/*
- Connection Problems:
# Check network status netstat -tunap | grep 10999 sudo tcpdump -i any port 10999
Security Measures
#!/bin/bash
# Configure firewall rules
sudo iptables -A INPUT -p tcp --dport 10999 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 10999 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 8768 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 27016 -j ACCEPT
# Set file permissions
chmod 750 ~/.klei/DoNotStarve
chmod 640 ~/.klei/DoNotStarve/cluster.ini
# Enable logging
sudo iptables -A INPUT -p tcp --dport 10999 -j LOG --log-prefix "DS_SERVER:"
Conclusion
With these configurations and maintenance procedures in place, your Don’t Starve server should provide a stable and optimized gaming experience for players in the Asia-Pacific region. Regular monitoring and maintenance are key to ensuring consistent performance.
- Regularly review server logs for potential issues
- Keep all scripts and configurations under version control
- Maintain documentation of any custom modifications
- Schedule regular performance reviews
- Keep backup system automated and verified