Skip to content

Instantly share code, notes, and snippets.

@davydmaker
Created January 6, 2026 02:09
Show Gist options
  • Select an option

  • Save davydmaker/601b3f11cc1c28bf75253038278cc582 to your computer and use it in GitHub Desktop.

Select an option

Save davydmaker/601b3f11cc1c28bf75253038278cc582 to your computer and use it in GitHub Desktop.
Proxy server script for Nintendo Switch on macOS
#!/bin/bash
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
PROXY_PORT=8888
CONFIG_FILE="$PWD/tinyproxy.conf"
PID_FILE="$PWD/tinyproxy.pid"
LOG_FILE="$PWD/proxy.log"
echo -e "${BLUE}Configuring Proxy for Nintendo Switch${NC}"
echo "=============================================="
if ! command -v tinyproxy &> /dev/null; then
echo -e "${RED}Error: tinyproxy is not installed${NC}"
echo -e "${YELLOW}Please install it with: brew install tinyproxy${NC}"
exit 1
fi
get_local_ip() {
local_ip=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}' | head -n1)
echo "$local_ip"
}
create_config() {
echo -e "${YELLOW}Creating configuration file...${NC}"
cat > "$CONFIG_FILE" << EOF
# TinyProxy configuration for Nintendo Switch
Port $PROXY_PORT
Listen 0.0.0.0
Timeout 600
DefaultErrorFile "/usr/local/share/tinyproxy/default.html"
StatFile "/usr/local/share/tinyproxy/stats.html"
Logfile "$LOG_FILE"
LogLevel Info
PidFile "$PID_FILE"
MaxClients 100
Allow 192.168.0.0/16
Allow 10.0.0.0/8
Allow 172.16.0.0/12
DisableViaHeader Yes
EOF
echo -e "${GREEN}Configuration file created${NC}"
}
check_port() {
if lsof -Pi :$PROXY_PORT -sTCP:LISTEN -t >/dev/null ; then
echo -e "${RED}Port $PROXY_PORT is already in use!${NC}"
echo -e "${YELLOW}Killing existing process...${NC}"
lsof -ti:$PROXY_PORT | xargs kill -9
sleep 2
fi
}
start_proxy() {
echo -e "${YELLOW}Starting proxy...${NC}"
check_port
[ -f "$PID_FILE" ] && rm -f "$PID_FILE"
tinyproxy -c "$CONFIG_FILE" -d &
proxy_pid=$!
sleep 3
if kill -0 $proxy_pid 2>/dev/null; then
echo $proxy_pid > "$PID_FILE"
echo -e "${GREEN}Proxy started successfully!${NC}"
return 0
else
echo -e "${RED}Failed to start proxy${NC}"
return 1
fi
}
show_info() {
local_ip=$(get_local_ip)
echo ""
echo -e "${GREEN}NINTENDO SWITCH CONFIGURATION:${NC}"
echo "=========================================="
echo -e "${BLUE}Proxy IP:${NC} $local_ip"
echo -e "${BLUE}Port:${NC} $PROXY_PORT"
echo ""
echo -e "${YELLOW}HOW TO CONFIGURE ON SWITCH:${NC}"
echo "1. Go to Settings > Internet"
echo "2. Select your Wi-Fi network"
echo "3. Choose 'Change settings'"
echo "4. In 'Proxy server' choose 'Yes'"
echo "5. Enter IP: $local_ip"
echo "6. Enter Port: $PROXY_PORT"
echo "7. Save and test connection"
echo ""
echo -e "${GREEN}Proxy Status:${NC}"
echo "- Log file: $LOG_FILE"
echo "- PID file: $PID_FILE"
echo ""
echo -e "${YELLOW}Press Ctrl+C to stop the proxy${NC}"
echo ""
}
main() {
create_config
echo ""
if start_proxy; then
show_info
echo -e "${BLUE}Monitoring logs (Ctrl+C to exit):${NC}"
echo "=================================================="
tail -f "$LOG_FILE" 2>/dev/null || echo "Waiting for connections..."
else
echo -e "${RED}Failed to start proxy. Check logs.${NC}"
exit 1
fi
}
cleanup() {
echo ""
echo -e "${YELLOW}Stopping proxy...${NC}"
if [ -f "$PID_FILE" ]; then
proxy_pid=$(cat "$PID_FILE")
if kill -0 $proxy_pid 2>/dev/null; then
kill $proxy_pid
rm -f "$PID_FILE"
echo -e "${GREEN}Proxy stopped${NC}"
fi
fi
exit 0
}
trap cleanup SIGINT SIGTERM
main
@davydmaker
Copy link
Author

Proxy for Nintendo Switch

Bash script to configure a proxy server on macOS for Nintendo Switch. Allows all network traffic from the Switch to pass through your Mac on the internal network.

Installation

Prerequisites:

  • macOS
  • Homebrew
  • Nintendo Switch on the same Wi-Fi network

Install TinyProxy:

brew install tinyproxy

Usage

Start the proxy:

./nintendo-switch-proxy.sh

The script will display your Mac's IP and port (8888). Press Ctrl+C to stop.

Configure on Nintendo Switch

  1. Go to Settings > Internet
  2. Select your Wi-Fi network
  3. Choose "Change settings"
  4. Set "Proxy server" to "Yes"
  5. Enter your Mac IP (shown by the script)
  6. Enter Port: 8888
  7. Save and test connection

Troubleshooting

  • Proxy won't start: Make sure port 8888 is free, or restart the script
  • Switch won't connect: Verify both devices are on the same Wi-Fi network and check the Mac IP
  • Port in use: The script automatically stops existing processes on port 8888

Use Case: Cloud Gaming with VPN

This script is particularly useful for accessing region-restricted cloud gaming services:

  1. Connect to a US VPN on your Mac
  2. Start the proxy with ./nintendo-switch-proxy.sh
  3. Configure the Switch to use the proxy (as described above)
  4. Access cloud games on Nintendo Switch that require US region

The Switch will route all traffic through your Mac, which is connected to the US VPN, allowing you to play cloud games that are only available in the US region.


Note: The proxy works only on your internal network. Keep your Mac powered on and connected to Wi-Fi while using the proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment