Skip to content

Instantly share code, notes, and snippets.

@jurre
Created October 19, 2013 15:39
Show Gist options
  • Save jurre/7057447 to your computer and use it in GitHub Desktop.
Save jurre/7057447 to your computer and use it in GitHub Desktop.
An easy way to set a macro with your local IP address, just add it as a build phase in Xcode.
#!/bin/sh
set -e
HEADER="${SRCROOT}/LearningSpaces-iPad/ip_address.h"
echo "// This file is generated by a build script." > $HEADER
echo "// Updated on "`date` >> $HEADER
echo "" >> $HEADER
ip_address="`ifconfig en0 | grep "inet " | cut -d: -f2 | awk '{print $2}'`"
echo "#define LOCAL_IP_ADDRESS @\"http://${ip_address}:3000\"" >> $HEADER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment