LizardByte / Sunshine

Self-hosted game stream host for Moonlight.
http://app.lizardbyte.dev/Sunshine/
GNU General Public License v3.0
17.9k stars 865 forks source link

Mac autostart fail #1909

Open d-dandrew opened 9 months ago

d-dandrew commented 9 months ago

Is there an existing issue for this?

Is your issue described in the documentation?

Is your issue 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
ReenigneArcher commented 9 months ago

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

Why?

d-dandrew commented 9 months ago

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.

Mirarchi commented 8 months ago

Same here, any clues or workarounds for this? Thanks

CHEETAHJinni commented 7 months ago

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.

[进程已完成]

miwagner1 commented 6 months ago

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

XuXianTao commented 6 months ago

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>
ReenigneArcher commented 6 months ago

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

wbrione commented 5 months ago

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"

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 commented 5 months ago

(...)

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/

Hazer commented 3 months ago

@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.

wbrione commented 3 months ago

@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 ?

ReenigneArcher commented 3 months ago

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

wbrione commented 3 months ago

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)

:-(

ReenigneArcher commented 3 months ago

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.

Hazer commented 3 months ago

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?

wbrione commented 3 months ago

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 commented 3 months ago

@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.

wgalternate commented 3 months ago

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

LizardByte-bot commented 3 days ago

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!