A complete, production-ready solution to transform a Raspberry Pi (3B+/4/5) into a Time Machine backup server for macOS, replacing the need for an expensive Apple Time Capsule.
| Advantage | Details |
|---|---|
| ✅ Always-on | Can run 24/7 with minimal power consumption (~5-10W) |
| ✅ Cost-effective | Hardware you may already own, no expensive Apple hardware |
| ✅ Full control | Configure exactly what you need, no vendor limitations |
| ✅ Samba 4.x | Complete vfs_fruit module support for Time Machine |
| ✅ USB 3.0 | Fast transfer speeds for external drives |
| ✅ Network accessible | Works on your local network and remotely via Tailscale VPN |
| ✅ Open source | Based on standard Linux technologies (Samba, Avahi) |
- Automated setup - Single script installation
- macOS auto-discovery - Appears natively in Time Machine preferences
- SMB3 protocol - Secure and fast transfers
- vfs_fruit support - Full macOS compatibility
- User authentication - Secure password-based access
- mDNS/Bonjour - Zero-configuration network discovery
- Tailscale ready - Works over VPN for remote backups
- Raspberry Pi 4 (4GB+ RAM recommended, Pi 3B+ works too)
- External USB drive (1TB+ recommended, formatted as ext4)
- Network connection (Ethernet preferred, WiFi works)
- Power supply - Reliable 5V/3A for Pi 4
- Raspberry Pi OS (Bullseye or Bookworm recommended)
- SSH access to your Raspberry Pi
- macOS 10.9+ (Mavericks or newer for Time Machine support)
-
Clone this repository:
git clone https://github.com/rizal72/TimeCapsule-Pi.git cd TimeCapsule-Pi -
Connect your external drive to the Raspberry Pi
-
Run the installer:
chmod +x install.sh sudo ./install.sh
-
Follow the prompts - the script will:
- Detect your external drive
- Format it as ext4 (with confirmation)
- Install and configure Samba
- Set up Avahi for macOS discovery
- Create a user account for Time Machine
- Configure auto-mount on boot
-
On your Mac: Open System Settings → General → Time Machine → Add Backup Disk
- Select TIMECAPSULE-PI → TimeCapsule
- Enter your credentials
- Start your first backup!
See MANUAL_INSTALL.md for detailed step-by-step instructions.
After installation, your Time Capsule will be configured as:
| Setting | Value |
|---|---|
| Server name | TIMECAPSULE-PI |
| Share name | TimeCapsule |
| Protocol | SMB3 (SMB2/3 forced, SMB1 disabled) |
| Quota | 1TB (configurable) |
| Authentication | User-based (no guest access) |
Edit /etc/samba/smb.conf to customize:
[TimeCapsule]
comment = Time Machine Backup on Raspberry Pi
path = /mnt/timecapsule
browseable = yes
read only = no
valid users = your_username
# Time Machine specific
fruit:time machine max size = 2T # Change quota here
vfs objects = catia fruit streams_xattrRestart Samba after changes:
sudo systemctl restart smbd nmbd- Use Ethernet instead of WiFi for faster backups
- USB 3.0 drive - Use a USB 3.0 port on your Pi 4
- First backup will take longer (several hours for large data sets)
- Subsequent backups are incremental and much faster
-
Check Samba is running:
systemctl status smbd nmbd
-
Check Avahi is running:
systemctl status avahi-daemon
-
Restart services:
sudo systemctl restart smbd nmbd avahi-daemon
- Verify firewall rules allow SMB (port 445)
- Check network connectivity:
ping pi4.local
-
Check disk is mounted:
df -h | grep timecapsule -
Verify permissions:
ls -la /mnt/timecapsule
-
The installer should set correct permissions automatically
Your Time Capsule works over Tailscale VPN, allowing backups from anywhere -- and it also works when you are on the same local network, so you can use a single address everywhere.
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale upImportant: If you installed TimeCapsule-Pi with a version before July 2026, Samba may be configured to only listen on your local network. To allow connections via Tailscale, edit /etc/samba/smb.conf and remove (or comment out) these lines:
# bind interfaces only = yes
# interfaces = 127.0.0.1 192.168.1.0/24Then restart Samba:
sudo systemctl restart smbd nmbdNew installations from install.sh after July 2026 already include this fix.
Tailscale provides a stable hostname that works both remotely and on your local network:
tailscale status
# Look for your Pi's name, e.g. pi4The full MagicDNS hostname is <hostname>.<tailnet>.ts.net. To find yours:
tailscale status --json | grep MagicDNSSuffix
# Example output: "MagicDNSSuffix": "tail9350d7.ts.net"
# Your Pi's address: pi4.tail9350d7.ts.netFrom anywhere (home or away), use Cmd+K in Finder:
smb://<your-pi-hostname>.tailnet.ts.net/TimeCapsule
For example: smb://pi4.tail9350d7.ts.net/TimeCapsule
Enter your Samba username and password -- the same credentials you use locally.
When you switch from a local address (e.g. smb://TIMECAPSULE-PI.local) to the Tailscale hostname, Time Machine will detect your existing .sparsebundle on the share and continue using it. The first backup via Tailscale may show a long "Preparing" phase -- this is normal, Time Machine is verifying the existing sparsebundle integrity, not re-uploading everything. Subsequent backups will be incremental.
Because the Tailscale MagicDNS hostname resolves both locally (direct connection) and remotely (via Tailscale), you can set it as your only Time Machine backup destination and forget about switching addresses when you change location.
Create additional Samba users:
sudo smbpasswd -a newusernameThen add them to valid users in /etc/samba/smb.conf.
TimeCapsule-Pi/
├── README.md # This file
├── README.it.md # Italian documentation
├── CLAUDE.md # AI assistant guidelines
├── MANUAL_INSTALL.md # Detailed manual setup guide
├── install.sh # Automated installer script
├── setup/
│ ├── smb.conf # Samba configuration template
│ └── timecapsule.service # Avahi mDNS service file
└── docs/
├── architecture.md # Technical details
└── troubleshooting.md # Common issues and solutions
- Samba Project - Excellent SMB server implementation
- Avahi Project - mDNS/Bonjour for Linux
- Raspberry Pi Foundation - Amazing little computer
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is provided as-is for educational and personal use.
Riccardo Sallusti
- GitHub: @rizal72
- Project started: February 2026
Note: This project replaces expensive Apple Time Capsule hardware with a configurable, open-source solution based on Raspberry Pi. It's been tested and confirmed working on macOS Tahoe 26.2 with Raspberry Pi 4 running Raspberry Pi OS Bullseye.
This software is provided "as is", without warranty of any kind. Always keep multiple backups of important data. The authors are not responsible for any data loss.