{"id":42210,"date":"2024-02-23T16:07:30","date_gmt":"2024-02-23T21:07:30","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=42210"},"modified":"2024-02-23T16:07:30","modified_gmt":"2024-02-23T21:07:30","slug":"swift-scripts-importing-cocoa-frameworks-broken-on-macos-14","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2024\/02\/23\/swift-scripts-importing-cocoa-frameworks-broken-on-macos-14\/","title":{"rendered":"Swift Scripts Importing Cocoa Frameworks Broken on macOS 14"},"content":{"rendered":"<p><a href=\"https:\/\/www.jessesquires.com\/blog\/2024\/01\/22\/swift-scripting-broken-macos-14\/\">Jesse Squires<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.jessesquires.com\/blog\/2024\/01\/22\/swift-scripting-broken-macos-14\/\">\n<p>On macOS 14 Sonoma there is a regression in Swift 5.9 which causes Swift scripts that import Cocoa frameworks to fail.<\/p>\n<p>[&#8230;]<\/p>\n<p>The <a href=\"https:\/\/github.com\/apple\/swift\/issues\/68785#issuecomment-1904624571\">current workaround<\/a> (also posted by <a href=\"https:\/\/github.com\/rdj\">@rdj<\/a>) is to update the shebang, <code class=\"language-plaintext highlighter-rouge\">#!\/usr\/bin\/swift<\/code>, by replacing it with the following:<\/p><pre>#!\/usr\/bin\/env DYLD_FRAMEWORK_PATH=\/System\/Library\/Frameworks \/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift<\/pre>\n<\/blockquote>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/06\/04\/scripting-languages-to-be-removed\/\">Scripting Languages to Be Removed<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jesse Squires: On macOS 14 Sonoma there is a regression in Swift 5.9 which causes Swift scripts that import Cocoa frameworks to fail. [&#8230;] The current workaround (also posted by @rdj) is to update the shebang, #!\/usr\/bin\/swift, by replacing it with the following:#!\/usr\/bin\/env DYLD_FRAMEWORK_PATH=\/System\/Library\/Frameworks \/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/swift Previously: Scripting Languages to Be Removed<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-02-23T21:07:33Z","apple_news_api_id":"05ea3378-167a-4d4c-8b9a-b7c7e5fb8a16","apple_news_api_modified_at":"2024-02-23T21:07:33Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/ABeozeBZ6TUyLmrfH5fuKFg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,30,2385,71,901],"class_list":["post-42210","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-mac","tag-macos-14-sonoma","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=42210"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42210\/revisions"}],"predecessor-version":[{"id":42211,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/42210\/revisions\/42211"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=42210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=42210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=42210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}