Agent installer script failing on Mac (maybe apple silicon related?)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
A number of issues occur when attempting to run the arm mac agent installer script, the most grave seeming to be the system immediately killing the agent due to unsigned code.
To Reproduce
Steps to reproduce the behavior:
- On an apple silicon mac download and run the
macOS arm64 Bash Installerfrom the downloads page. - Observe a number of error including:
su: illegal option -- c(occurs on the second run of the installer)
This appears to occur because$Owneris not set and$Owneris not set because the brew binary is not installed at/usr/local/bin/brewfor apple silicon macs (https://github.com/Homebrew/install/blob/aceed88a4a062e2b41dc40a7428c71309fce14c9/install.sh#L154). A couple of suggestions to help with this, firstly addingset -ewould help a lot in terms of making it clearer where the source of an issue is rather than having bash continue on blindly afterlsfails and then dying later on down the line about something seemingly unrelated (I find http://redsymbol.net/articles/unofficial-bash-strict-mode/ to be quite helpful). Wrapping$Ownerin quotes would also help since if $Owner is not set"$Owner"will still be given tosuas an argument (an empty string) rather than having that argument excluded all together thus causingsuto think the next argument (-c) is an argument forsuwhich doesn't have a-cflag, hence the error. (I find ShellCheck very helpful for catching these sorts of things.)
But for fixing the actual issue of brew living at a different path when installed on arm macs I think it might be easiest to use$(which brew)rather than hardcoding the path to the brew binary.chmod: /usr/local/bin/Remotely/Desktop/Remotely_Desktop: No such file or directory
The unzippedRemotely-MacOS-arm64.zipfile doesn't includeDesktop/Remotely_Desktopso chmod throws an error when trying to make a file at that path executable.Bootstrap failed: 5: Input/output error
When trying to runsudo launchctl bootstrap system /Library/LaunchDaemons/remotely-agent.plistthis error is thrown. I'm not entirely sure why but I when I run the program which that launchd plist is attempting to start (/usr/local/bin/Remotely/Remotely_Agent) the system seems to immediately SIGKIL the process.
And looking at console.app it seems to be due to a code-signing issue:bash-5.2$ /usr/local/bin/Remotely/Remotely_Agent Killed: 9AMFI: hook..execve() killing pid 96044: Attempt to execute completely unsigned code (must be at least ad-hoc signed). ASP: Security policy would not allow process: 96044, /usr/local/bin/Remotely/Remotely_Agent
I didn't have the capacity to debug further but I thought I'd at least report the issue and hopefully someone else will have the time fix it.
Remotely Version
Server: 2024.02.23.1927
Agent: N/A
Expected Behavior
The agent installer to complete successfully
Additional Details
Also not major thing but might be nice if the script actually checked to see if brew, curl and jq is already installed first before blindly attempting to install again. I have all 3 installed already so I was initially a bit confused why I was greeted with this the first time I tried to run the agent installer script:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew
Press RETURN/ENTER to continue or any other key to abort:
Desktop Details:
-
Device: Mac Studio M1 Max
-
OS: macOS Sonoma 14.2.1
-
Browser: N/A
-
Version: N/A
-
I am running Remotely in Docker and not on my QNAP, Synology, or Internet Connected Toaster
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the macOS arm64 Bash Installer flow on Apple silicon and inspect the installer steps involving /opt/homebrew/bin/brew, /usr/local/bin/Remotely/Remotely_Agent, and /Library/LaunchDaemons/remotely-agent.plist. Done means the installer handles existing Homebrew tools, installs the expected files, and launchctl bootstrap starts the agent without the reported path or code-signing failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, csharp, macos
- Domain
- desktop, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100