Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppleScript error 1 when installing command line tools on M1 Mac (11.2.1) #213

Open
jmitrevs opened this issue Feb 18, 2021 · 16 comments
Open
Milestone

Comments

@jmitrevs
Copy link

On my MacBook Air with Apple Silicon, using OS 11.2.1, I get the following message when I attempt to install the command line tools. I am running the standard Aquamacs 3.5 under emulation.

let*: AppleScript error 1

@treese
Copy link
Collaborator

treese commented Feb 18, 2021

Thanks for the report.

Check in System Preferences->Security & Privacy->Privacy tab -> Accessibility and make sure that Aquamacs is listed as one of the apps "allowed to control your computer”. The exact menu is a bit different depending on your version of Mac OS, but you should be able to find it.

In the next release, which I hope to have out in a few weeks, Aquamacs is configured to prompt for that access so it won’t be so mysterious.

I'll leave this open until you confirm that it's working for you.

(For anyone who cares, this is the same as #185).

@jmitrevs
Copy link
Author

It doesn't seem to fix the problem. I still get the error.

@treese
Copy link
Collaborator

treese commented Feb 19, 2021

The nightly build at https://aquamacs.org/nightlies.html has some changes to ask for the needed permissions. I'm not 100% sure it would get it, but it might be worth a check if you have a little time to do it.

It may be possible that it also needs full disk access permissions for this.

If I can find a clean Big Sur system to try it on, I'll see if it works there (on Intel, at least).

@HayoBaan
Copy link
Contributor

HayoBaan commented Feb 20, 2021

Hi Win,

I tried the nightly on my Big Sur (Intel) machine after first removing Aquamacs from the Accessibility tab. This worked fine for me and it correctly asked for permission. However, that worked fine with the older (standard 3.5) version I normally use as well so I can't verify if anything has really improved.

Note: the help panel that opens after starting the new version for the first time does not show any content (only an error). In fact neither does the original 3.5. Help is (completely?) broken.

@treese
Copy link
Collaborator

treese commented Feb 21, 2021

Thanks for the check, @HayoBaan

@jmitrevs
Copy link
Author

jmitrevs commented Feb 21, 2021 via email

@James6M
Copy link

James6M commented Sep 12, 2022

Same exact failure to report with Aquamacs 3.6 on macOS 12.5.1 on Intel silicon (2019 iMac). Aquamacs does have Accessibility permissions, however this doesn't smell to me like a permissions problem, at least not one to do with Accessibility. I tried after giving Aquamacs "Full Disk Access," and that also failed.

@treese
Copy link
Collaborator

treese commented Sep 15, 2022

This is related to #213, though with different symptoms (and possibly different exact causes). I made some post-3.6 changes for it, but they're not in a release yet because I'm working on merging Aquamacs up to Emacs 28 to make Aquamacs 4.

@James6M Do you also have a workaround? If not, please reply and we can get you one.

@James6M
Copy link

James6M commented Sep 19, 2022

I'm a bit confused—this is #213. Do you mean that the Apple silicon/Intel silicon difference is significant?
Anyhow, I have no workaround. If one is easily available (jmitrevs's script, maybe?) that would save me some time. Thanks!

@treese
Copy link
Collaborator

treese commented Sep 20, 2022

Sorry, I think I meant #226.

@James6M Quick question: does your account on your Mac have administrator privileges? If you run Tools->Install command line tools, does it prompt for a password?

If Aquamacs is installed as /Applications/Aquamacs.app, the following command might work. If not, you can edit the pathname to wherever Aquamacs is installed.

To get the basic setup for the command line tools it might work to run these commands in a shell in Terminal

mkdir /usr/local/bin
cp '/Applications/Aquamacs.app/Contents/MacOS/bin/aquamacs' \
   '/Applications/Aquamacs.app/Contents/MacOS/bin/emacsclient' \
   '/usr/local/bin/' \
    && \
    ln -sf '/Applications/Aquamacs.app/Contents/MacOS/bin/emacs' \
       '/usr/local/bin/emacs'

There may have been another Apple change in the security details that's interfering with this on

@James6M
Copy link

James6M commented Sep 20, 2022

Ah! Reading #226 taught me something about what is going on.

Yes, I'm in an admin account. Yes: The process that "Tools menu>InstallCLT" launches first shows a confirmation dialog, and then asks for a password. Then the error message appears in the mini-buffer and Messages buffer. At that point, the menu bar has also shrunk to only have an "Auquamacs" menu (containing just the two Hide items) and an "Edit" menu (just the basic System items). Clicking out & into Aquamacs is required to restore the full menu bar.

Working in an xterm, all three of the suggested shell commands (mkdir, cp, and ln) required sudo. After completing them with sudo, "which emacs" returned the new link ($PATH already had /usr/local/bin, without any direct intervention by me), but attempting to run it leads to the #226 error. [The Good News: I actually have Aquamacs.app nested in a folder within /Applications. The error showed that it was correctly finding that.]

I don't know the reason for the sequence of symlinks, but making the edit suggested in #226 resulted in something functional. But maybe I misunderstood what Command Line Tools is intended for, because it opens Aquamacs within the xterm (I guess no surprise, now that I see the -nw). Removing the -nw (in the script) resulted in the GUI opening, but as a second instance if Aquamacs was already open, and without my customizations.

So I think that is progress, but I'm not sure it is progress in the direction I desired. I was hoping for a command line command which would open a file, with interface customizations, and without creating a second instance if Aquamacs was already open.

@treese
Copy link
Collaborator

treese commented Sep 20, 2022

We should make some better documentation about what the command-line tools are!

The script currently installs 3 programs in /usr/local/bin:

  • aquamacs, which launches Aquamacs.app if needed, but otherwise will open a file in a running one. Does that do what you want?
  • emacs, which basically runs plain Emacs in a terminal window (we might have some discussion about what would be reasonable to use from Aquamacs there, but I think the main use case is a quick Emacs edit in Terminal, not a main way of using Aquamacs)
  • emacslient, which can be used in conjunction with server-start in Aquamacs to invoke operations remotely or ask a running Aquamacs to edit a file. This overlaps what aquamacs does, although they do it in different ways, and emacsclient requires you to turn on the server yourself, since it's not enabled by default.

@James6M
Copy link

James6M commented Sep 21, 2022

Ah, yes, the "aquamacs" script is what I was hoping for. I've now pointed /usr/local/bin/emacs at the script within Aquamacs.app. That seemed cleaner than copying into /usr/local/bin; I hope I'm not violating some organizational principle.

After writing my message, I found the info in the Aquamacs Manual (section 4.5). So that's a findability issue, rather than a clarity issue. Selecting "Aquamacs Manual" in the Aquamacs Help menu fails for me.

I've never before tried opening a PDF in Aquamacs. Nifty. But for about 2 seconds there was something in the frame about "Display Mode" or something, which disappeared (when the PDF loaded) before I could read it. I can't get that information back. I wonder what it said.

Anyhow, this has now drifted well off topic. I hope that the sudo information helps with resolving the AppleScript error problem.

@treese
Copy link
Collaborator

treese commented Sep 21, 2022

I'm glad we solved the immediate problem. Working through this pointed up a few things that can be improved, and they'll probably go into a round of fixes after Aquamacs 4.0 comes out (or possibly with Aquamacs 4).

Using the symlink on your system is fine. This discussion raises some questions about the right way to do all of that, which bear some thought.

You might be able to find the "Display Mode" messages in the *Messages* buffer, which logs all the things displayed in the echo area at the bottom of the frame.

@treese
Copy link
Collaborator

treese commented Sep 21, 2022

Forgot to add: I'm leaving this open for Aquamacs 4+ work, since some of the underlying issues are still problems.

@treese treese modified the milestones: Post-4.0, 4.0 Sep 21, 2022
@James6M
Copy link

James6M commented Sep 21, 2022

Trailing tidbits: Help menu> Aquamacs Manual now works for me, probably because I just upgraded v.3.5 -> v.3.6 (on a different computer than where I was getting CLT installed).

The upgrade also reset the system, so that I saw the PDF mystery message again. It starts roughly "Welcome to Docview", so my mention of "Display Mode" was incorrect. It is not saved in Messages buffer, because it was not displayed in the minibuffer, but rather (apparently) in the same buffer where the PDF is going. But it looks like this is emacs functionality , so probably not something for Aquamacs to worry about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants