Created
June 28, 2012 17:34
-
-
Save georgkreimer/3012716 to your computer and use it in GitHub Desktop.
Configure Mobile Safari on the Simulator allow remote debugging of web pages and open safari to view the inspector.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Configure Mobile Safari on the Simulator allow remote debugging of web pages | |
# and open safari to view the inspector. | |
# | |
# If you want to open the Simulator from the command line you might like the | |
# following alias: | |
# alias iphone-simulator="open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app" | |
# | |
pid=$(ps x | egrep "MobileSafari|Web.app" | grep -v grep | awk '{ print $1 }') | |
if [ "$pid" == "" ]; then | |
echo "Safari.app must be running in the Simulator to enable the remote inspector." | |
else | |
cat <<EOS | gdb -quiet > /dev/null | |
attach $pid | |
p (void *)[WebView _enableRemoteInspector] | |
detach | |
EOS | |
osascript <<EOS > /dev/null 2>&1 | |
tell application "Safari" | |
activate | |
do JavaScript "window.open('http://localhost:9999')" in document 1 | |
end tell | |
EOS | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment