Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Mac autostart fail

Open d-dandrew opened this issue 1 year ago • 18 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your issue described in the documentation?

  • [X] I have read the documentation

Is your issue present in the nightly release?

  • [X] This issue is present in the nightly release

Describe the Bug

After running sudo port load Sunshine, Sunshine can't autostart on Mac startup. launchctl shows it is loaded

% sudo launchctl list | grep macports
-	0	org.macports.Sunshine
-	0	org.macports.shared-mime-info-updater

Expected Behavior

No response

Additional Context

what is checked: running sunshine directly in the terminal apps is working screen recording enable the terminal app and sunshine excutable (sunshine softlink is deleted and rename sunshine-0.21.0 is renamed to sunshine) run sudo port load Sunshine multiple times without fail-info tried launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist but not fixing this

Host Operating System

macOS

Operating System Version

12.7.1

Architecture

64 bit

Sunshine commit or version

0.21.0

Package

macOS - Portfile

GPU Type

Intel

GPU Model

Intel Iris Pro 1536 MB

GPU Driver/Mesa Version

Metal GPUFamily macOS 1

Capture Method (Linux Only)

No response

Config

~/.config/sunshine/sunshine.conf

controller = disabled

Apps

No response

Relevant log output

cant find a log file in launchctl

d-dandrew avatar Dec 11 '23 09:12 d-dandrew

sunshine softlink is deleted and rename sunshine-0.21.0 is renamed to sunshine

Why?

ReenigneArcher avatar Dec 11 '23 14:12 ReenigneArcher

sunshine softlink is deleted and rename sunshine-0.21.0 is renamed to sunshine

Why?

sunshine-0.21.0 can't be recognize in Finder as an Unix Excutable file but shown as unknow document file, even after I chmod +x the sunshine-0.21.0 file.

d-dandrew avatar Dec 12 '23 03:12 d-dandrew

Same here, any clues or workarounds for this? Thanks

Mirarchi avatar Dec 27 '23 20:12 Mirarchi

I tried replacing the filename, but when I run it I get the following message:

Last login: Fri Jan 19 03:53:51 on ttys000 mac@Macintosh ~ % /Applications/usr/bin/sunshine ; exit; dyld[38449]: Library not loaded: '/usr/local/opt/opus/lib/libopus.0.dylib' Referenced from: '/Applications/usr/bin/sunshine' Reason: tried: '/usr/local/opt/opus/lib/libopus.0.dylib' (no such file), '/usr/local/lib/libopus.0.dylib' (no such file), '/usr/lib/libopus.0.dylib' (no such file) zsh: abort /Applications/usr/bin/sunshine

Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[进程已完成]

CHEETAHJinni avatar Jan 18 '24 19:01 CHEETAHJinni

Ah I was wondering why sunshine was not working for me.

miwagner1 avatar Feb 18 '24 01:02 miwagner1

I try to add a new plist to run sunshine to solve the problem.

  1. sudo vi /Library/LaunchDaemons/my-autostart.macports.sunshine.plist
  2. press i to insert code
  3. copy the next code to the file and replace [your current account name] to your current account name.
  4. sudo launchctl load /Library/LaunchDaemons/my-autostart.macports.sunshine.plist
  5. Reboot your mac and it run successfully in my case
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>my-autostart.macports.sunshine</string>
	<key>UserName</key>
	<string>[your current account name]</string>

    <key>RunAtLoad</key>
    <true/>

    <key>KeepAlive</key>
    <true/>

    <key>ProgramArguments</key>
    <array>
        <string>/opt/local/bin/sunshine</string>
    </array>
</dict>
</plist>


There is also a org.macports.Sunshine.plist in /Library/LaunchDaemons/ and it look like to run sunshine, but it seems like not work successfully, no idea why it doesn't work

<?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>Label</key><string>org.macports.Sunshine</string>
<key>ProgramArguments</key>
<array>
        <string>/opt/local/bin/daemondo</string>
        <string>--label=Sunshine</string>
        <string>--start-cmd</string>
        <string>/opt/local/bin/{Sunshine}</string>
        <string>;</string>
        <string>--restart-netchange</string>
        <string>--pid=exec</string>
</array>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>

XuXianTao avatar Mar 03 '24 11:03 XuXianTao

My guess is it's trying to load the macport one before the user is actually logged in.

ReenigneArcher avatar Mar 03 '24 13:03 ReenigneArcher

There is also a org.macports.Sunshine.plist in /Library/LaunchDaemons/ and it look like to run sunshine, but it seems like not work successfully, no idea why it doesn't work

<?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>Label</key><string>org.macports.Sunshine</string>
<key>ProgramArguments</key>
<array>
        <string>/opt/local/bin/daemondo</string>
        <string>--label=Sunshine</string>
        <string>--start-cmd</string>
        <string>/opt/local/bin/{Sunshine}</string>
        <string>;</string>
        <string>--restart-netchange</string>
        <string>--pid=exec</string>
</array>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>

@XuXianTao , just replace "{Sunshine}" on original .plist to "sunshine"...

Grant "screen recording permission" to the executable "/opt/local/bin/daemondo"

  • https://support.apple.com/pt-br/guide/mac-help/mchld6aa7d23/mac
  • https://macpaw.com/how-to/access-opt-folder-on-mac

After the service starts, its settings, logs, etc. can be accessed in ~root/.config/sunshine

So, auto start "fixed", however, I still have a problem...

When accessing the desktop, the MacOS desktop is displayed, however, that's it... there are no more screen updates.

If I open an application, I don't see the new window for it in my "moonlight" client :-(

This happens whether running sunshine as a service, in the context of "root", or interactively, via terminal, from my user.

wbrione avatar Mar 31 '24 21:03 wbrione

(...)

So, auto start "fixed", however, I still have a problem...

When accessing the desktop, the MacOS desktop is displayed, however, that's it... there are no more screen updates.

If I open an application, I don't see the new window for it in my "moonlight" client :-(

This happens whether running sunshine as a service, in the context of "root", or interactively, via terminal, from my user.

Thank God.... I'm not the only one to face this type of problem on the Mac :joy:... Would the "solution" be to downgrade Sunshine?!

https://www.reddit.com/r/MoonlightStreaming/comments/197g7pu/sunshine_does_it_only_support_latest_macos_v20/

wbrione avatar Apr 01 '24 10:04 wbrione

@wbrione Hey, can you try again with the new nightly? My PR https://github.com/LizardByte/Sunshine/pull/2485 that fixes encoding issues with macOS got merged and seems to fix issues for most users.

Hazer avatar May 16 '24 23:05 Hazer

@wbrione Hey, can you try again with the new nightly? My PR #2485 that fixes encoding issues with macOS got merged and seems to fix issues for most users.

Apologies for my delay @Hazer ... So, because I found it easier to manage, I ended up adopting the "brew" installation method, which did not present the problems to setup auto start services as like macport.

Anyway, assuming I were to use the method via macport again, how do I install the "nightly" version with this fix ?

wbrione avatar May 19 '24 11:05 wbrione

You download the Portfile from the release of interest, in this case https://github.com/LizardByte/Sunshine/releases/nightly-dev

ReenigneArcher avatar May 19 '24 11:05 ReenigneArcher

You download the Portfile from the release of interest, in this case https://github.com/LizardByte/Sunshine/releases/nightly-dev

@ReenigneArcher ... I would really like to stay with the "brew installation method"...

How to download and install the latest version (pre-release)?! You know how ?!

When trying to install, it always downloads the source of the current release (v0.23.1 8b21db6)

:-(

wbrione avatar May 19 '24 17:05 wbrione

I thought you asked how to use the nightly Portfile.

For brew, I'm not 100% sure but I think you can use the head branch somehow.

ReenigneArcher avatar May 19 '24 17:05 ReenigneArcher

How to download and install the latest version (pre-release)?! You know how ?!

@wbrione

brew tap LizardByte/homebrew
brew install sunshine --HEAD

@ReenigneArcher I should probably submit a PR including instructions for nightly macOS installation to the docs, shouldn't I?

Hazer avatar May 19 '24 19:05 Hazer

How to download and install the latest version (pre-release)?! You know how ?!

@wbrione

brew tap LizardByte/homebrew
brew install sunshine --HEAD

@ReenigneArcher I should probably submit a PR including instructions for nightly macOS installation to the docs, shouldn't I?

@Hazer ... Thank you very much... It worked!!! Now just wait a few hours to finish the compilation/installation... I'll be back with feedback soon ;-)

About improving documentation... It would be very good, especially for people like me, who are "newbies" when it comes to the MacOS universe and its tools.

You would be amazed at how many people on the internet have exactly this doubt... I researched a lot before before asking for help here ;-)

Once again, thank you very much for everyone's attention.

wbrione avatar May 19 '24 20:05 wbrione

@Hazer , everything works Ok now... The only question for me now is understand why my mouse pointer disappears when I open, for example, Safari ;-) ... The pointer works, it just doesn't appear in the streaming (only while streaming), perhaps due to interference from another software, like Barrier (KVM), since I don't have a physical mouse connected to MacOS

Thank you very, very much for the support.

wbrione avatar May 20 '24 23:05 wbrione

@wbrione Do you have the steps to get it to autostart using the homebrew method?

wgalternate avatar Jun 12 '24 08:06 wgalternate