Skip to content

Instantly share code, notes, and snippets.

@davidxia
Created May 15, 2013 05:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save davidxia/5581861 to your computer and use it in GitHub Desktop.
build xcode project without opening the damned thing
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# David Xia 2013
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
WORKSPACE=$1
SCHEME=$2
SDK=$3
ARCH=$4
CONFIGURATION=$5
LOGFILE=$6
function help
{
echo "Usage: $0 <workspace> <scheme> <sdk> <arch> <app_path> [configuration] [logname]"
echo "<workspace> TBA"
echo "<scheme> TBA"
echo "<sdk> TBA"
echo "<arch> TBA"
echo "<app_path> TBA"
echo "[configuration] (optional) Debug or Release, defaults to Debug"
echo "[logname] (optional) the log file to write to. defaults to stderror.log"
}
# check first argument
if [ -z "${WORKSPACE}" ] || [ -z "${SCHEME}" ] || [ -z "${SDK}" ] || [ -z "${ARCH}" ]; then
help
exit 1
fi
# default to "Debug"
if [ -z "${CONFIGURATION}" ] ; then
CONFIGURATION=Debug
fi
# default to "stderror.log"
# if [ -z "${LOGFILE}" ] ; then
# LOGFILE=stderr.log
# fi
# backup existing logfile (start fresh each time)
# if [ -f ${LOGFILE} ]; then
# mv ${LOGFILE} ${LOGFILE}.bak
# fi
xcodebuild -workspace ${WORKSPACE} -scheme ${SCHEME} -sdk ${SDK} -arch ${ARCH}
# ios-sim launch ${APP_PATH} --stderr ${LOGFILE} --exit
# osascript -e "tell application \"iPhone Simulator\" to activate"
# tail -f ${LOGFILE}
@davidxia
Copy link
Author

brew install ios-sim

then

ios-sim launch /Users/david/Library/Developer/Xcode/DerivedData/<foo>/Build/Products/Debug-iphonesimulator/<foo>.app --stderr stderr.log --exit

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