Production-ready Python script to automatically rotate Tor exit IP addresses on macOS.
- macOS (tested on macOS 15+)
- Homebrew package manager
- Python
brew install tor python
pip3 install stem requestsEdit /opt/homebrew/etc/tor/torrc (Apple Silicon) or /usr/local/etc/tor/torrc (Intel):
ControlPort 9051
CookieAuthentication 1
# OR use hashed password instead:
# HashedControlPassword 16:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CookieAuthFileGroupReadable 1
SOCKSPort 9050Generate a hashed password (if using password auth):
tor --hash-password "your_password"Start Tor service (or run manually: tor):
brew services start tor
Verify Tor is running:
curl --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip# Show help
python3 main.py -h
# Rotate IP every 60 seconds (default)
python3 main.py
# Custom interval (seconds)
python3 main.py -i 30
# Custom control port
python3 main.py -p 9051
# With password authentication
python3 main.py --password "your_password"
# Rotate once and exit
python3 main.py --once
# Validate Tor setup and configuration
python3 main.py --validateThis tool is provided for educational and privacy research purposes only.
- Legal compliance: Use in accordance with your local laws and regulations
- Terms of Service: Respect Tor network policies and exit node operators' policies
- No illegal activities: Do not use for illegal activities, abuse, or harassment
- Respect rate limits: Rotate IPs responsibly (minimum 10 second interval)
- No warranty: Use at your own risk. No liability for misuse or damages
MIT License - See LICENSE file for details.
