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

Homebrew service not starting #64

Closed
EyadElshaer opened this issue May 22, 2023 · 25 comments
Closed

Homebrew service not starting #64

EyadElshaer opened this issue May 22, 2023 · 25 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@EyadElshaer
Copy link

when I play any music on the Apple Music app on the MacBook it doesn't show up on discord I tried restarting the Mac but nothing helped

@NathanielH-snek
Copy link

Yeah for me it only works if i manually run it in the terminal

@EyadElshaer
Copy link
Author

Yeah for me it only works if i manually run it in the terminal

For me it doesn't work even if I run it in the terminal

@NathanielH-snek
Copy link

Are you launching it from brew or path?

@EyadElshaer
Copy link
Author

Are you launching it from brew or path?

How can I know ?

@NathanielH-snek
Copy link

What do you type into the terminal to run it in terminal? Did you install with homebrew?

@EyadElshaer
Copy link
Author

What do you type into the terminal to run it in terminal? Did you install with homebrew?

I downloaded homebrew and used the terminal to run it

@NathanielH-snek
Copy link

That didn't really answer but I'm assuming you didnt do anything besides copying the install command. Type:
music-rpc.ts into the terminal and it should run for you

@EyadElshaer
Copy link
Author

What do you type into the terminal to run it in terminal? Did you install with homebrew?

I typed what was shown in the installation commands

@allycatty
Copy link

allycatty commented May 28, 2023

I've tried installing manually and with brew in every way I could on multiple macs, tried upgrading deno, no luck whatsoever.
Are we supposed to create an application in the discord dev portal? Or is it possibly and issue with the change in Discord username discriminators?

@NathanielH-snek
Copy link

I've tried installing manually and with brew in every way I could on multiple macs, tried upgrading deno, no luck whatsoever.

Are we supposed to create an application in the discord dev portal? Or is it possibly and issue with the change in Discord username discriminators?

Have you tried launching the application manually the way I mentioned above. It works, I think the problem is the automatic script to have it launch on startup. Probably broken by macOS at some point.

@NextFire
Copy link
Owner

NextFire commented Jun 9, 2023

@EyadElshaer If you installed it with Homebrew, check that the script is running fine on a manual run with music-rpc.ts in the terminal as @NathanielH-snek suggested.

@allycatty The script should run as it is and works fine with the new username system.

If you encounter some issues with the launch agent, try the troubleshooting steps in #51. If it is not working at all, please ensure that activity sharing is well enabled in your Discord client settings.

@mjcarvin
Copy link

I'm running into the same problem. I went through the troubleshooting steps here and in #51 ...

  1. manually running music-rpc.ts from the terminal works and activity sharing is turned on in Discord.

  2. brew services output

Name                    Status       User    File
apple-music-discord-rpc error  19968 michael ~/Library/LaunchAgents/homebrew.mxcl.apple-music-discord-rpc.plist
  1. brew services info apple-music-discord-rpc output
brew services info apple-music-discord-rpc
apple-music-discord-rpc (homebrew.mxcl.apple-music-discord-rpc)
Running: ✘
Loaded: ✔
Schedulable: ✘
  1. brew services start apple-music-discord-rpc output
brew services start apple-music-discord-rpc
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/michael/Library/LaunchAgents/homebrew.mxcl.apple-music-discord-rpc.plist` exited with 5.
  1. File permissions
-rw-r--r--   1 michael  staff   953 Jun 13 11:59 homebrew.mxcl.apple-music-discord-rpc.plist

@NextFire
Copy link
Owner

@mjcarvin Do you happen to use an Apple Silicon Mac?

@mjcarvin
Copy link

No, Intel MBP - skylake from 2016.

@NextFire
Copy link
Owner

NextFire commented Jun 13, 2023

I've updated the formula which previously had a linting issue NextFire/homebrew-tap@093eb08.
I am not sure that it will resolve this issue but can you brew update && brew reinstall nextfire/tap/apple-music-discord-rpc && brew services restart nextfire/tap/apple-music-discord-rpc and check brew services info apple-music-discord-rpc again?

@NathanielH-snek
Copy link

I do run an AS mac and I'm having the same issue although I haven't spent a lot of time troubleshooting. I'll see if I can figure it out later.

@mjcarvin
Copy link

I've updated the formula which previously had a linting issue NextFire/homebrew-tap@093eb08.
I am not sure that it will resolve this issue but can you brew update && brew reinstall nextfire/tap/apple-music-discord-rpc && brew services restart nextfire/tap/apple-music-discord-rpc and check brew services info apple-music-discord-rpc again?

brew services info apple-music-discord-rpc

apple-music-discord-rpc (homebrew.mxcl.apple-music-discord-rpc)
Running: ✘
Loaded: ✔
Schedulable: ✘
brew services

Name                    Status       User    File
apple-music-discord-rpc error  19968 michael ~/Library/LaunchAgents/homebrew.mxcl.apple-music-discord-rpc.plist
sleepwatcher            started      michael ~/Library/LaunchAgents/homebrew.mxcl.sleepwatcher.plist

@NextFire
Copy link
Owner

@mjcarvin Can you paste the content of the generated launch agent?

@mjcarvin
Copy link

{
	EnvironmentVariables = {
		PATH = "/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin";
	};
	KeepAlive = YES;
	Label = "homebrew.mxcl.apple-music-discord-rpc";
	"LimitLoadToSessionType" = (
		Aqua,
		Background,
		LoginWindow,
		StandardIO,
		System,
	);
	ProgramArguments = (
		"/usr/local/opt/apple-music-discord-rpc/bin/music-rpc.ts",
	);
	RunAtLoad = YES;
	StandardErrorPath = "/Users/michael/music-rpc.log";
	WorkingDirectory = "/usr/local/var/apple-music-discord-rpc";
}

That PATH looks really short compared to echo $PATH

/Users/michael/.gem/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/michael/Development/flutter/bin:/usr/local/opt/:/Users/michael/Library/Android/sdk/platform-tools:/Users/michael/Library/Android/sdk/tools:/Users/michael/Library/Android/sdk/tools/bin:/Users/michael/Library/Android/sdk/emulator

@NextFire
Copy link
Owner

Is it the raw content of your .plist? Should have been some XML.
The PATH is fine if it contains at least osascript and deno (check with which).
Then if both /usr/local/opt/apple-music-discord-rpc/bin/music-rpc.ts and /usr/local/var/apple-music-discord-rpc exist, I don't see any reason for it not working... :/
(The music-rpc.log should have been located in /usr/local/var/apple-music-discord-rpc, not in the home root, I'll fix that at least...)

@mjcarvin
Copy link

That was the raw content. Here's the xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>EnvironmentVariables</key>
	<dict>
		<key>PATH</key>
		<string>/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin</string>
	</dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>homebrew.mxcl.apple-music-discord-rpc</string>
	<key>LimitLoadToSessionType</key>
	<array>
		<string>Aqua</string>
		<string>Background</string>
		<string>LoginWindow</string>
		<string>StandardIO</string>
		<string>System</string>
	</array>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/opt/apple-music-discord-rpc/bin/music-rpc.ts</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/Users/michael/music-rpc.log</string>
	<key>WorkingDirectory</key>
	<string>/usr/local/var/apple-music-discord-rpc</string>
</dict>
</plist>

which osascript and which deno return good paths, so that's fine.

music-rpc.ts is in /usr/local/opt/apple-music-discord-rpc/bin/ and running it manually from my home root works fine.

This is not right on my end

from the xml

<key>WorkingDirectory</key>
	<string>/usr/local/var/apple-music-discord-rpc</string>
ls -la /usr/local/var

total 0
drwxrwxr-x   4 michael  admin  128 May 20 14:22 .
drwxr-xr-x  14 root     wheel  448 May 20 14:02 ..
drwxrwxr-x   4 michael  admin  128 May 20 14:10 homebrew
drwxr-xr-x   3 michael  admin   96 May 20 14:22 run

@NextFire
Copy link
Owner

/usr/local/var/apple-music-discord-rpc is automatically created when the service starts (re-checked on my side) so no problem here

@NextFire
Copy link
Owner

I guess I'm out of answer, there may be a bug in homebrew/services.
As a last resort can you try the shell scripts install method in the README? You may have better luck here...

@NextFire NextFire changed the title It doesn't work Homebrew service not starting Jun 13, 2023
@NextFire NextFire added bug Something isn't working help wanted Extra attention is needed labels Jun 13, 2023
@mjcarvin
Copy link

/usr/local/var/apple-music-discord-rpc is automatically created when the service starts (re-checked on my side) so no problem here

Huh. I don't see it in my /usr/local/var folder.

As a last resort can you try the shell scripts install method in the README? You may have better luck here...

I just did and it started right up when I ran the install script.

Thanks for making the time to help diagnose this. I really appreciate it.

@NextFire
Copy link
Owner

NextFire commented Jun 13, 2023

Huh. I don't see it in my /usr/local/var folder.

Yeah somehow Homebrew couldn't even start its generated launch agent...

I just did and it started right up when I ran the install script.

Perfect!

Thanks for making the time to help diagnose this. I really appreciate it.

You're welcome! Thank you for your quick replies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants