像这样
export PATH=$PATH:/Applications/Xcode6-Beta.app/Contents/DeveloperToolchains/XcodeDefault.xctoolchain/usr/bin
但我发现这篇文章How to use swift in your terminal
哪一个更好?
解决方法 我通过xcrun使用它:$xcrun swift -v -o test test.swiftSwift version 1.0 (swift-600.0.34.4.5)Target: x86_64-apple-darwin14.0.0/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -enable-objc-attr-requires-objc-module -target x86_64-apple-darwin14.0.0 -module-name test -sdk /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -color-diagnostics -o /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o/usr/bin/ld /var/folders/2p/rs8p19s957ggyxzntnj3tp_40000gn/T/test-bb5ff8.o -force_load /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a -syslibroot /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -lSystem -arch x86_64 -L /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -rpath /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -macosx_version_min 10.10.0 -no_objc_category_merging -o test
但请注意,swift库是从/Applications/Xcode6-Beta/…/swift/macosx加载的(通过@rpath),因此二进制文件不能在另一个系统上运行,除非它在同一个地方安装了相同版本的Xcode .除非您想要进行大量复制/ install_name_tool调用以对其进行排序…
$otool -l test |fgrep path name @rpath/libswiftAppKit.dylib (offset 24) name @rpath/libswiftCoreGraphics.dylib (offset 24) name @rpath/libswiftDarwin.dylib (offset 24) name @rpath/libswiftdispatch.dylib (offset 24) name @rpath/libswiftFoundation.dylib (offset 24) name @rpath/libswiftObjectiveC.dylib (offset 24) name @rpath/libswift_stdlib_core.dylib (offset 24) path /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx (offset 12)总结
以上是内存溢出为你收集整理的如何在终端中使用Swift全部内容,希望文章能够帮你解决如何在终端中使用Swift所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)