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 Bundle always starts services #1274

Closed
br3ndonland opened this issue Jan 2, 2024 · 4 comments · Fixed by #1277
Closed

Homebrew Bundle always starts services #1274

br3ndonland opened this issue Jan 2, 2024 · 4 comments · Fixed by #1277
Assignees
Labels

Comments

@br3ndonland
Copy link

Description

My global Brewfile includes some formulae with services. Initially I had the services set up to restart when changed, like this:

tap "homebrew/bundle"
tap "homebrew/services"
brew "black", restart_service: :changed
brew "postgresql@16", restart_service: :changed

I rarely use the services, so I don't need them running continuously. I updated the Brewfile to include restart_service: false, start_service: false like this:

tap "homebrew/bundle"
tap "homebrew/services"
brew "black", restart_service: false, start_service: false
brew "postgresql@16", restart_service: false, start_service: false

When I run brew services stop --all, I can see that the services stop, but then they get restarted on the next brew bundle install --global.

When I uninstall the formulae with brew uninstall, then run brew bundle install --global, the services are installed and started again.

I tried deleting .Brewfile.lock.json but this had no effect.

Example terminal session (expand)
~ on ☁️  (us-east-2)
❯ cat ~/.Brewfile
cask_args appdir: "/Applications", require_sha: true
tap "homebrew/bundle"
tap "homebrew/services"

brew "awscli"
brew "bash"
brew "black", restart_service: false, start_service: false
brew "ffmpeg"
brew "findutils"
brew "flake8"
brew "gh"
brew "git"
brew "git-lfs"
brew "gnupg"
brew "gnu-sed"
brew "gnu-tar"
brew "go"
brew "grep"
# brew "helm"
brew "httpie"
brew "jq"
brew "jupyterlab"
brew "libfido2"
brew "macos-trash" if OS.mac?
brew "mas" if OS.mac?
brew "media-info"
brew "mkvtoolnix"
brew "mp4v2"
brew "mypy"
# brew "mysql-client"
brew "node"
brew "openssh"
brew "opentofu"
brew "pinentry"
# brew "pinentry-mac"
brew "pipx"
brew "pnpm"
brew "postgresql@16", restart_service: false, start_service: false
brew "pre-commit"
brew "prettier"
brew "python"
brew "r"
brew "rclone"
brew "rust"
brew "shellcheck"
brew "shfmt"
brew "starship"
brew "taplo"
brew "terraform@1.5"
brew "terragrunt"
# brew "terraformer"
brew "typescript"
brew "wrangler"
brew "ykman"
brew "zsh"
brew "zsh-completions"
brew "zsh-syntax-highlighting"

cask "1password"
cask "1password-cli"
cask "brave-browser"
# cask "datagrip"
# cask "docker"
cask "firefox"
# cask "inkscape"
cask "karabiner-elements"
cask "kitty"
# cask "notion"
cask "orbstack"
# cask "postico"
# cask "postman"
cask "protonvpn"
# cask "rstudio"
# cask "session-manager-plugin"
# cask "slack"
cask "syncthing"
# cask "visual-studio-code"
cask "vlc"
cask "vscodium"
# cask "zoom"
cask "zotero" # no arm64_big_sur yet

# mas "1password", id: 1333542190
mas "1password for safari", id: 1569813296
mas "bear", id: 1091189122
mas "daisydisk", id: 411643860
mas "duckduckgo privacy essentials", id: 1482920575
mas "keynote", id: 409183694
mas "numbers", id: 409203825
mas "pages", id: 409201541
mas "pdf expert", id: 1055273043

~ on ☁️  (us-east-2)
❯ brew services list
Name          Status  User    File
black         started brendon ~/Library/LaunchAgents/homebrew.mxcl.black.plist
dbus          none
postgresql@16 started brendon ~/Library/LaunchAgents/homebrew.mxcl.postgresql@16.plist
unbound       none

~ on ☁️  (us-east-2)
❯ brew services stop --all
Stopping `black`... (might take a while)
==> Successfully stopped `black` (label: homebrew.mxcl.black)
Warning: Service `dbus` is not started.
Stopping `postgresql@16`... (might take a while)
==> Successfully stopped `postgresql@16` (label: homebrew.mxcl.postgresql@16)
Warning: Service `unbound` is not started.

~ on ☁️  (us-east-2)
❯ brew services list
Name          Status User File
black         none
dbus          none
postgresql@16 none
unbound       none

~ on ☁️  (us-east-2)
❯ brew bundle check --global
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################ 100.0%
==> Downloading https://formulae.brew.sh/api/formula.jws.json
############################################################################################ 100.0%
brew bundle can't satisfy your Brewfile's dependencies.
Satisfy missing dependencies with `brew bundle install`.

~ on ☁️  (us-east-2) took 2s
❯ brew bundle install --global
Using homebrew/bundle
Using homebrew/services
==> Downloading https://formulae.brew.sh/api/formula.jws.json

Using awscli
Using bash
Using black
Using ffmpeg
Using findutils
Using flake8
Using gh
Using git
Using git-lfs
Using gnupg
Using gnu-sed
Using gnu-tar
Using go
Using grep
Using httpie
Using jq
Using jupyterlab
Using libfido2
Using macos-trash
Using mas
Using media-info
Using mkvtoolnix
Using mp4v2
Using mypy
Using node
Using openssh
Using opentofu
Using pinentry
Using pipx
Using pnpm
Using postgresql@16
Using pre-commit
Using prettier
Using python
Using r
Using rclone
Using rust
Using shellcheck
Using shfmt
Using starship
Using taplo
Using terraform@1.5
Using terragrunt
Using typescript
Using wrangler
Using ykman
Using zsh
Using zsh-completions
Using zsh-syntax-highlighting
==> Downloading https://formulae.brew.sh/api/cask.jws.json

Using 1password
Using 1password-cli
Using brave-browser
Using firefox
Using karabiner-elements
Using kitty
Using orbstack
Using protonvpn
Using syncthing
Using vlc
Using vscodium
Using zotero
Using 1password for safari
Using bear
Using daisydisk
Using duckduckgo privacy essentials
Using keynote
Using numbers
Using pages
Using pdf expert
Homebrew Bundle complete! 71 Brewfile dependencies now installed.

~ on ☁️  (us-east-2) took 4s
❯ brew services list
Name          Status  User    File
black         started brendon ~/Library/LaunchAgents/homebrew.mxcl.black.plist
dbus          none
postgresql@16 started brendon ~/Library/LaunchAgents/homebrew.mxcl.postgresql@16.plist
unbound       none

~ on ☁️  (us-east-2) took 4s
❯ brew uninstall jupyterlab python-lsp-server black postgresql@16
Warning: Treating jupyterlab as a formula. For the cask, use homebrew/cask/jupyterlab
Uninstalling /opt/homebrew/Cellar/jupyterlab/4.0.10... (4,650 files, 91.9MB)
Uninstalling /opt/homebrew/Cellar/python-lsp-server/1.9.0_1... (2,363 files, 7.5MB)
Uninstalling /opt/homebrew/Cellar/black/23.12.1... (301 files, 4.0MB)
Uninstalling /opt/homebrew/Cellar/postgresql@16/16.1_1... (3,796 files, 68.3MB)

~ on ☁️  (us-east-2) took 2s
❯ brew services list
Name    Status User File
dbus    none
unbound none

~ on ☁️  (us-east-2)
❯ brew bundle install --global
Using homebrew/bundle
Using homebrew/services
Using awscli
Using bash
Installing black
Using ffmpeg
Using findutils
Using flake8
Using gh
Using git
Using git-lfs
Using gnupg
Using gnu-sed
Using gnu-tar
Using go
Using grep
Using httpie
Using jq
Installing jupyterlab
Using libfido2
Using macos-trash
Using mas
Using media-info
Using mkvtoolnix
Using mp4v2
Using mypy
Using node
Using openssh
Using opentofu
Using pinentry
Using pipx
Using pnpm
Installing postgresql@16
Using pre-commit
Using prettier
Using python
Using r
Using rclone
Using rust
Using shellcheck
Using shfmt
Using starship
Using taplo
Using terraform@1.5
Using terragrunt
Using typescript
Using wrangler
Using ykman
Using zsh
Using zsh-completions
Using zsh-syntax-highlighting
Using 1password
Using 1password-cli
Using brave-browser
Using firefox
Using karabiner-elements
Using kitty
Using orbstack
Using protonvpn
Using syncthing
Using vlc
Using vscodium
Using zotero
Using 1password for safari
Using bear
Using daisydisk
Using duckduckgo privacy essentials
Using keynote
Using numbers
Using pages
Using pdf expert
Homebrew Bundle complete! 71 Brewfile dependencies now installed.

~ on ☁️  (us-east-2) took 19s
❯ brew services list
Name          Status  User    File
black         started brendon ~/Library/LaunchAgents/homebrew.mxcl.black.plist
dbus          none
postgresql@16 started brendon ~/Library/LaunchAgents/homebrew.mxcl.postgresql@16.plist
unbound       none
Output from recommended Homebrew troubleshooting steps (expand)

~ on ☁️  (us-east-2)
❯ brew update
Already up-to-date.

~ on ☁️  (us-east-2)
❯ brew update
Already up-to-date.

~ on ☁️  (us-east-2)
❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  openssl@1.1

Warning: Putting non-prefixed findutils in your path can cause python builds to fail.

~ on ☁️  (us-east-2) took 4s
❯ brew config
HOMEBREW_VERSION: 4.2.2
ORIGIN: https://github.com/Homebrew/brew
HEAD: 705d2564ddfb9c915ee9425dd9ed408bfac61005
Last commit: 28 hours ago
Core tap JSON: 02 Jan 21:23 UTC
Core cask tap JSON: 02 Jan 21:23 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: codium --wait
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.43.0 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.2.1-arm64
CLT: 15.1.0.0.1.1700200546
Xcode: N/A
Rosetta 2: false

Suggestions

Expected behavior:

  • brew bundle install would not start services if restart_service: false, start_service: false
  • brew bundle check would take restart_service: false, start_service: false into account

Related

@MikeMcQuaid
Copy link
Member

Can you try omitting restart_service and start_service entirely? I suspect we don't handle false correctly here.

@br3ndonland
Copy link
Author

Can you try omitting restart_service and start_service entirely? I suspect we don't handle false correctly here.

Thank you for the suggestion. Indeed, when I omit restart_service and start_service entirely, like this:

tap "homebrew/bundle"
tap "homebrew/services"
brew "black"
brew "postgresql@16"

I then run brew bundle install --global, and see that the services do not start and that brew bundle check --global passes.

~
❯ brew services list
Name          Status User File
black         none
dbus          none
postgresql@16 none
unbound       none

~
❯ brew bundle check --global
The Brewfile's dependencies are satisfied.

I'm happy to help resolve the issue if you can point me in the general direction. I'm not much of a Rubyist but can probably figure it out.

@br3ndonland
Copy link
Author

Thank you for your prompt assistance with this issue. I can confirm Homebrew Bundle is now working as expected.

@MikeMcQuaid
Copy link
Member

@br3ndonland Thanks for reporting back, happy to help!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants