从命令行使用xcodebuild构建可可应用后,该如何运行?

从命令行使用xcodebuild构建可可应用后,该如何运行?

问题描述:

我正在使用这样的Xcode项目从命令行构建Mac OS X Cocoa应用程序:

I'm building a Mac OS X Cocoa application from the command line using an Xcode project like this:

xcodebuild -scheme MyApp -configuration Debug

构建完成后如何运行?

我写了一个脚本来做到这一点:

I wrote a script to do this:

#!/bin/bash

x=$( xcodebuild -showBuildSettings -project MyApp.xcodeproj | grep ' BUILD_DIR =' | sed -e 's/.*= *//' )

DYLD_FRAMEWORK_PATH=$x/Debug DYLD_LIBRARY_PATH=$x/Debug $x/Debug/MyApp.app/Contents/MacOS/MyApp

(我是通过从Xcode运行应用程序,然后在进程上运行ps -wwE -p来查看其环境变量来解决这个问题的.)

(I figured this out by running the application from Xcode and then ps -wwE -p on the process to see its environment variables.)