zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.97k stars 2.83k forks source link

Stop suggesting auto-update when installed via Homebrew #13825

Open Peiffap opened 3 months ago

Peiffap commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Whenever a new update is available, the "Click here to update and restart" (probably paraphrased) notification shows up in the bottom left corner. When I click it, Zed closes and updates, but does not automatically restart.

Environment

Zed: v0.142.5 (Zed) -- technically, this is after the update, but I was on the latest version before that. OS: macOS 12.7.5 Memory: 8 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

I would want the application to automatically restart after the update is completed, reopening the same window I was on when I updated.

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

https://github.com/user-attachments/files/16099398/Zed.log

mrnugget commented 3 months ago

How did you install Zed originally? Downloading the *.dmg?

Can you paste the logs contents too?

Peiffap commented 3 months ago

I've added the logs to the issue message. I'm fairly confident I downloaded the *.dmg originally, but I don't exclude the possibility I installed through Homebrew (I have Zed brewed too but it was still on version 0.140.5, so it's not the version I've been using).

Peiffap commented 3 months ago

Actually, on second thought it might've been the brewed version; I'll uninstall everything and see what happens when I reinstall from the *.dmg.

Peiffap commented 3 months ago

Okay; that seems to work fine (i.e. downloaded v0.142.4, which restarts properly after updating to v0.142.5). I'm not sure what the issue was, but I'm assuming it must be something about Homebrew versions not liking the way updating works?

mrnugget commented 3 months ago

Okay; that seems to work fine (i.e. downloaded v0.142.4, which restarts properly after updating to v0.142.5). I'm not sure what the issue was, but I'm assuming it must be something about Homebrew versions not liking the way updating works?

Yeah, I'd say so. When we download an update, we download the *.dmg, mount it and copy its contents to the current installation location. I don't think that works well when installed via Homebrew and its symlinks.

Officially we don't support the Homebrew version of Zed, but we should probably not show the auto-update if we can detect that it was installed via Homebrew.

We already have support for that:

https://github.com/zed-industries/zed/blob/d450a1d9e6b19380f3978090478fcf6b03e07b51/crates/auto_update/src/auto_update.rs#L174-L183

So the homebrew version would need to set ZED_UPDATE_EXPLANATION when compiling or when starting Zed.

Peiffap commented 3 months ago

That makes sense to me. Thanks for taking a look at this!