osacompile: no such component "AppleScript"

I created an app that uses AppleScript to automatically convert .numbers files to .csv by opening it in Numbers and using the Export function.

After one of the recent updates¹, in Xcode 11.5 (macOS 10.15.5) this no longer works. It shows the error:

osacompile: no such component "AppleScript".

I get the same error when I manually run the osacompile command in Terminal.

¹The last time I successfully compiled it was on 15 October 2019, so I was already running Catalina, but I don't know which of the updates since then broke it.

How to reproduce


Even without a valid test.applescript file, this is an easy way to reproduce it:

/usr/bin/osacompile -l AppleScript -d -o test.scpt test.applescript

This command gives me the same error.

A simple way to reproduce it in Xcode is to create a new project and make it an AppleScript App.

It can also be reproduced by using this project:

https://github.com/hhas/Swift-AppleScriptObjC

It's impossible to compile now.

Can anyone confirm if this is a bug in macOS / Xcode or just on my system?
Answered by Ruyven in 615241022
It worked! Thank you so much!

Using fs_usage with grep and bbedit I found out that one of the files it accessed was ~/Library/Components/Script Debugger.component from the app Script Debugger.
After deleting the component, the error was gone.

Just for fun, I opened Script Debugger again and it recreated the component file, but the error didn't come back. May have been a bug in an old version of the Script Debugger component that has since been fixed.
I think this is just your system. I just repeated your test here and things work as expected:

Code Block
% sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.5
BuildVersion: 19F101
% cat test.applescript
display dialog "Hello Cruel World!"
% /usr/bin/osacompile -l AppleScript -d -o test.scpt test.applescript
% osascript test.scpt
«class bhit»:OK


If you create a new user and then log in as that user, do you still see the problem?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 22 Jun through to Fri, 26 Jun. During that time all of DTS will be busy with conference duties.
Wow.. it indeed works when I log in as a new user.

So something must be wrong with the osascript preferences in my account, right?
Do you know where osascript's preferences are stored?
Accepted Answer

So something must be wrong with the osascript preferences in my account, right?

It certainly seems that way.

Do you know where osascript’s preferences are stored?

No, sorry.

In situations like this I’ve been known to run the code under fs_usage (see its man page) to see what files it accesses and see if there’s any obvious problem with them.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
It worked! Thank you so much!

Using fs_usage with grep and bbedit I found out that one of the files it accessed was ~/Library/Components/Script Debugger.component from the app Script Debugger.
After deleting the component, the error was gone.

Just for fun, I opened Script Debugger again and it recreated the component file, but the error didn't come back. May have been a bug in an old version of the Script Debugger component that has since been fixed.
I hit this too, but blowing out the script debugger component fixed it. And the recreated component didn't cause any problems. So looks like that's a good fix for the osacompile issue.

One thing I noticed is that when I ran osalang -l, the system was VERY confused about what languages it actually had. doing the remove and renew with the SD component fixed that as well.

I was having this problem:

osacompile: no such component "AppleScript".

and removing ~/Library/Components/Script Debugger.component fixed it for me too!

Thanks!

This worked for me, too. I ran

sudo fs_usage -w -f filesys osascript 

in one terminal window, and then ran my applescript command (in my case it was for the odrive file sync setup program)

echo 'open location "http://www.odrive.com"' | osascript 

in another terminal window. I looked at the output in the first window and sure enough, a random component was mentioned several times. Using the path listed, I deleted

 ~/Library/Audio/Plug-Ins/Components/Guitar Rig 5.component 

and then everything worked. Thanks so much for the detailed troubleshooting instructions!

osacompile: no such component "AppleScript"
 
 
Q