Trying to create an AppleScript executable for MacOS 11.5 using Xcode 13 with AppleScript framework. Right out of the box (no processing on my part), the delegate icon on the IB display does not point to the default AppleScript code. This is clear since the outlet list for the icon claims that the AppDelegate does not have an outlet named theWindow whereas the AppleScript code clearly does. I've been trying for days to do a simple Hello World sort of thing and have been completely unable to connect UI elements with the "delegate", especially action elements. Am I missing some configuration step or is this a Xcode 13 bug? In examples I've seen on YouTube for creating this for this kind of simple thing the normal Xcode storyboard techniques work as expected (e.g. ctrl drag) but none of them used Xcode 13. Any insight is appreciated.screenshot of IB delegate binding
4 Answers
For future reference, this is starting to pop up on various forums, and appears to be a bug.
The normal signatures for creating IB outlets and action handlers is not being recognized by the Interface Editor. Existing projects - including the base Xcode templates - will build normally, although the editor shows warnings that outlets/actions don’t exist.
There isn’t much of a workaround other than creating objects programmatically or going back to an earlier version of Xcode until a fix is issued.
Update:
As mentioned in other answers and comments, the IB outlet and action handler connection bug has been fixed in Xcode 14, but the AppleScript application and Automator action templates are no longer included.
Custom templates can be created (or copied from an earlier version of Xcode from its Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/macOS/Other folder) and placed in a custom templates folder in your user’s Library folder at ~/Library/Developer/Xcode/Templates/. You can name this template folder whatever you want, such as "My Templates", where it will be shown in the template chooser.
Each template contains a TemplateInfo.plist file with various settings for that template - a complete tutorial is beyond the scope of this topic, but the value for the key "Identifier" in the base dictionary can be used to give your template a custom identifier, such as "com.my.cocoaApplicationAppleScript".

- 3,162
- 2
- 10
- 18
-
1Thanks for this - I've been fighting with XCode for the last hour trying to understand why I can't connect a button to my script. I downloaded XCode 12.5.1, created a simple xib with a button connected to the script, then found and copied over the relevant code to my MainMenu.xib. Works fine, but would be nice for this to get fixed up – Michael Dec 09 '21 at 11:27
-
Is there any update on this issue? I would prefer running macOS 12.x, but it does not support XCode 12.5.1 (apparently the latest version not having this bug…) – Max Wyss May 29 '22 at 11:37
I am using 13.4.1 and the bug is still there. I am wondering its its worth trying version 14 beta to see if it has been resolved

- 133
- 8
Playing around with this a little, I did find a workaround, though it's not entirely satisfactory. It amounts to editing the xib xml directly. For example, say you have button in the GUI that you'd like to reference in your script. First, create a property in the AppleScript like so:
property myButton : missing value
Then navigate to the xib file in Xcode, right-click on the xib in the file navigator and choose Open as... → Source Code
(the default is "interface Builder XIB Document", which you'll want to return to later). This will show you the xml that underlies the graphical representation. First, search through the text to find the button in question. It will look something like:
<window title="Window" ...>
...
<view key="contentView" id="...">
...
<subviews>
<button ... id="xok-ud-pwL">
...
</button>
</subviews>
</view>
</window>
You want to get the id
from the button, which in this case is "xok-ud-pwL". Then go back up to the top of the xml and look for the AppDelegate entry, which will look like:
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
You'll want to edit this so that it looks like the following:
<customObject id="Voe-Tx-rLC" customClass="AppDelegate">
<connections>
<outlet property="myButton" destination="xok-ud-pwL" id="gn6-Ea-hra"/>
</connections>
</customObject>
property
should be the name of the property in the scriptdestination
should be the id value of the button you want to connectid
should be a random and unique alphanumeric in 3-2-3 format
This will create an outlet connection between the property and the GUI element. It will even appear in the pop-up menu for the appDelegate so that you can reconnect it graphically. However, if you delete the connection in IB, Xcode will delete the entry from the xml, so you'll have to start again from scratch.
Still buggy, but...

- 2,921
- 2
- 7
- 17
-
Thanks Ted, that did work but as you say a little clumbersome. I wondered if this had been resolved in Version 14 beta so installed it and was shocked to see that there is no longer an option to even create an AppleScript Project. I have no idea why and I am even more perplexed as to hear that this bug has been round for quite a bit now with no fix. – Ian Barber Jul 08 '22 at 21:43
-
@IanBarber: Eh, betas are betas. If they are actually trying to fix this bug it wouldn't surprise me that they pulled the template from the beta until it's all patched. And Apple is notoriously slow on bug fixes. I'd like to think it's because they're being thorough... – Ted Wrigley Jul 08 '22 at 23:54
-
Removing the template until fixed wasn't something I had thought about and it makes perfect sense. Thanks Ted – Ian Barber Jul 09 '22 at 10:06
The Release Candidate version of Xcode 14 patch it !
"Fixed an issue with outlet and action connections to AppleScript-based AppDelegates. (83373726) (FB9643535)"
But, you can't create a new project. If you could find this old Template directory from an Xcode version < 14, you could add again the template AppleScript App.
Quit Xcode
Copy source template from version < 14 (I used v12.4): /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/macOS/Other/AppleScrip App.xctemplate
Copy to the destination folder: /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Other/
Restart Xcode
I think Apple wants to remove AppleScript in next version of MacOS
Tested on Xcode 14 (14A309) 11 Sept 2022!
Regards
Laurent
-
1Overall a good first answer! I have just a couple of points to raise: While this answer may be true (I have not tested it), let's see if you can verify it with the shipping version of Xcode 14. The answer may also be improved by leaving out speculation about Apple's plans if not publicly stated. Finally, as the general nature of SO, no need to sign at the bottom of the post as you would a letter or email. Otherwise, congratulations on your first SO answer! Cheers to many more in your future! – Cameron Sep 15 '22 at 20:14