Three bash scripts to enable macOS Internet Sharing (Personal Hotspot) without requiring an actual internet connection. Perfect for creating local WiFi networks for development, testing, or device-to-device communication.
- Zero dependencies - Uses only native macOS commands
- Smart & safe - Preserves existing configurations
- Reversible - Easy setup and teardown
- State tracking - Remembers what was changed
- Tested on macOS 13+ (Sonoma, Sequoia)
Creates or reuses a network service on the loopback interface and configures it for Internet Sharing.
What it does:
- Finds your active internet connection and saves it
- Creates "AdHoc" network service on
lo0(or reuses existing) - Assigns IP 10.10.10.1 if needed (preserves existing IPs)
- Saves state for safe removal
Safely disables Internet Sharing and restores your original configuration.
What it does:
- Turns off Internet Sharing completely
- Re-enables your original internet connection
- Removes IP configuration (only if added by setup)
- Preserves the network service (doesn't delete it)
Completely resets the loopback interface to macOS defaults (optional cleanup).
What it does:
- Removes ALL network services from
lo0 - Cleans all IP addresses except 127.0.0.1
- Restores pristine macOS state
# Download the scripts
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/setup-adhoc-network.sh
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/remove-adhoc-network.sh
curl -O https://gist.github.com/[your-username]/[gist-id]/raw/restore-loopback-native.sh
# Make executable
chmod +x setup-adhoc-network.sh remove-adhoc-network.sh restore-loopback-native.sh./setup-adhoc-network.shThen manually enable in System Settings:
- Go to System Settings > General > Sharing > Internet Sharing
- Share connection from: AdHoc (or the service name shown)
- To computers using: Wi-Fi
- Enable the toggle ✓
Your Mac will now broadcast a WiFi network without requiring internet!
./remove-adhoc-network.shThis will:
- ✓ Turn off Internet Sharing
- ✓ Re-enable your original internet service
- ✓ Clean up IP configuration (only what was added)
- ✓ Preserve the network service for future use
./restore-loopback-native.shUse this to completely remove all custom network services from lo0 and restore to factory defaults.
macOS requires an active network service with an IP address before allowing Internet Sharing. The trick:
- Creates a network service on the loopback interface (
lo0) - Assigns a static IP (10.10.10.1) to simulate an active connection
- macOS is tricked into thinking there's internet available
- Internet Sharing becomes enabled without requiring real internet
The scripts intelligently handle existing configurations, track changes, and provide safe cleanup.
All commands are native to macOS:
networksetup- Network configurationifconfig- Interface configuration/usr/libexec/PlistBuddy- Property list editingplutil- Property list conversionlaunchctl- Service managementroute- Routing table- Standard Unix tools:
grep,awk,sed,cut,killall
No installations required:
- ✗ No Homebrew
- ✗ No Xcode Command Line Tools
- ✗ No Python or other languages
- ✓ Works on fresh macOS installation
- macOS 13+ (tested on Sonoma & Sequoia)
- Administrator (sudo) privileges
- Works on Intel and Apple Silicon Macs
- The network service will remain visible in System Settings (this is normal and harmless)
- Internet Sharing will broadcast WiFi but won't provide actual internet access (as intended)
- Scripts require sudo password when run
- The
lo0interface is only used for the trick - your actual network adapters are not affected
Perfect for:
- Local development - Test networked applications without internet
- IoT device setup - Connect devices that need WiFi configuration
- Device-to-device communication - Create ad-hoc networks
- Testing - Simulate network environments
- Offline demos - Present without relying on venue WiFi
- Run
./remove-adhoc-network.shfirst to clean up - Run
./setup-adhoc-network.shagain - Check System Settings to ensure the AdHoc service is selected
- The service might be disabled - check System Settings > Network
- Run setup script again to recreate it
- Run
./restore-loopback-native.shto reset everything - Then run
./setup-adhoc-network.shto set up again
These scripts are provided as-is for educational and development purposes. Use at your own risk.
Created to solve the frustrating limitation of macOS Internet Sharing requiring an actual internet connection.
Questions, issues, or improvements? Leave a comment on the Reddit thread or create an issue on this Gist!
Last Updated: November 2025 Tested On: macOS Sonoma 14.x, macOS Sequoia 15.x, Mac Studio M4 Max