Skip to content

Instantly share code, notes, and snippets.

@acoomans
Last active September 3, 2015 16:29
Show Gist options
  • Select an option

  • Save acoomans/98918af88cd7445b8009 to your computer and use it in GitHub Desktop.

Select an option

Save acoomans/98918af88cd7445b8009 to your computer and use it in GitHub Desktop.
iOS simulator command line executable

iOS simulator command line executable

First compile

make

Then run with by setting the IPHONE_SDK env var first:

IPHONE_SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk

tell dyld what libraries to use and run the app:

IPHONE_SIMULATOR_ROOT=$IPHONE_SDK \
DYLD_SHARED_REGION=avoid \
DYLD_ROOT_PATH=$IPHONE_SDK \
DYLD_FALLBACK_FRAMEWORK_PATH=$IPHONE_SDK/System/Library/Frameworks \
DYLD_FALLBACK_LIBRARY_PATH=$IPHONE_SDK/usr/lib \
DYLD_FALLBACK_FRAMEWORK_PATH=$IPHONE_SDK/System/Library/Frameworks \
DYLD_FALLBACK_LIBRARY_PATH=$IPHONE_SDK/usr/lib \
./t
sdk = /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk
all: t
%: %.m
clang \
-x objective-c \
-miphoneos-version-min=7.0 \
-arch i386 \
-fobjc-arc \
-isysroot $(sdk) \
-F$(sdk)/System/Library/Frameworks/ \
-framework Foundation \
-o $@ $<
clean:
rm t
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
NSLog(@"%@", @"hello");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment