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

Undefined method 'plist_startup' on running service #133

Open
adinklotz opened this issue Jan 2, 2024 · 3 comments
Open

Undefined method 'plist_startup' on running service #133

adinklotz opened this issue Jan 2, 2024 · 3 comments

Comments

@adinklotz
Copy link

adinklotz commented Jan 2, 2024

I'm getting an error trying to set up the service:

❯ brew services start restic-automatic-backup-scheduler
Error: undefined method `plist_startup' for #<Formula restic-automatic-backup-scheduler (stable) /opt/homebrew/Library/Taps/erikw/homebrew-tap/Formula/restic-automatic-backup-scheduler.rb>
Did you mean?  plist_name
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formula_wrapper.rb:71:in `service_startup?'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/services_cli.rb:280:in `service_load'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/services_cli.rb:122:in `block in start'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/services_cli.rb:97:in `each'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/services_cli.rb:97:in `start'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/commands/start.rb:12:in `run'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/cmd/services.rb:130:in `services'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `<main>'

It sounds like this may be related to a recent breaking change to Homebrew service definitions - it looks like hopefully a quick fix but unfortunately I don't have the understanding of homebrew internals or time to learn them right now

Running Homebrew 4.2.2-4-g080e61f, macOS 14.2.1

@jjdevega
Copy link

I am getting the same error, macOS 13.6.1 and homebrew 4.2.3 (freshly reinstalled).

@olalonde
Copy link

olalonde commented Jan 26, 2024

Same error. It looks like brew is not creating the ~/Library/LaunchAgents/homebrew.mxcl.restic-automatic-backup-scheduler.plist file.

edit: workaround:

adding the following to /opt/homebrew/Library/Taps/erikw/homebrew-tap/Formula/restic-automatic-backup-scheduler.rb seems to fix the issue:

  service do
    name macos: "#{plist_name}"
  end

edit2: nvm, getting this error now:

$ brew services start restic-automatic-backup-scheduler                                                                                                                                      stable
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/redacted/Library/LaunchAgents/homebrew.mxcl.restic-automatic-backup-scheduler.plist` exited with 5.

@johnsturgeon
Copy link

Fix appears to be this

diff --git a/lib/service/formula_wrapper.rb b/lib/service/formula_wrapper.rb
index 095b58a..c5b6d0c 100644
--- a/lib/service/formula_wrapper.rb
+++ b/lib/service/formula_wrapper.rb
@@ -68,7 +68,7 @@ module Service
         return @service_startup
       end

-      @service_startup ||= formula.plist_startup.present?
+      @service_startup ||= formula.plist_name.present?
     end

     # Path to destination service directory. If run as root, it's `boot_path`, else `user_path`.

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