Failing to start Raycast command scripts - MacOS Sonoma
GregoireGonzalez opened this issue · comments
Hi,
Since MacOs Sonoma, I am failing to launch any of my previously working command scripts.
Here is one example of failing command script:
`#!/usr/bin/swift
// Required parameters:
// @raycast.schemaVersion 1
// @raycast.title Copy last download
// @raycast.mode silent
// Optional parameters:
// @raycast.icon 🤖
// Documentation:
// @raycast.author #######
import AppKit
// MARK: - Main
guard let download = latestDownloadURL() else {
print("No recent downloads")
exit(1)
}
copyToPasteboard(download)
print("Copied (download.lastPathComponent)")
// MARK: - Convenience
func latestDownloadURL() -> URL? {
guard let downloadsDirectory = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask).first else { return nil }
return try? FileManager.default
.contentsOfDirectory(at: downloadsDirectory, includingPropertiesForKeys: [.addedToDirectoryDateKey], options: .skipsHiddenFiles)
.sorted { $0.addedToDirectoryDate > $1.addedToDirectoryDate }
.first
}
func copyToPasteboard(_ url: URL) {
NSPasteboard.general.clearContents()
NSPasteboard.general.writeObjects([url as NSPasteboardWriting])
}
extension URL {
var addedToDirectoryDate: Date {
return (try? resourceValues(forKeys: [.addedToDirectoryDateKey]).addedToDirectoryDate) ?? .distantPast
}
}
`
Here is the error I'm getting when trying to run this command script
Error: JIT session error: Symbols not found: [_OBJC_CLASS_$_NSPasteboar...
I hope this will help 😄
this is an issue at the swift level swiftlang/swift#68785
Hey @GregoireGonzalez, thanks for the feedback, but as @jacoblange-dev this is a swift-level issue for those scripts importing AppKit. It does suck, though! We will see if we can somehow mitigate it from Raycast level, but I am not sure we will.
Thanks guys ! I'm pretty new to mac / raycast / swift / apple in general :) I'll check what happened to swift then.