Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
An easy way to set a macro with your local IP address, just add it as a build phase in Xcode.
set -e
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