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
Let flutter be installable via homebrew #14050
Comments
@gspencergoog you might be interested |
https://docs.brew.sh/Formula-Cookbook The process is pretty straight-forward. Though we'd have to make sure it integrates with our https://github.com/flutter/flutter/wiki/Release-process, ideally in an automated way. |
Hi Flutter team! I started adding a
Right now the Homebrew formula just downloads the current beta release, unzips it, and copies it to Flutter's Keg (eg. Any feedback would be welcome! |
@jcollins-g wrt to the shlock from Homebrew/homebrew-core#27395, maybe we can check if shlock returns not permitted / 1 and parent process id is brew, don't shlock. Also we can lock write to parts of the cache to prevent self update when brew installed. |
For context in that Homebrew PR, I wrote about the |
Actually, we went through this idea a bit more and I think ultimately, we'd want the official formula to be in a homebrew tap (non-core repository). This way, we can keep the flutter upgrade and brew upgrade targets hermetically synchronized. Hopefully we can bring a version of your formula into the tap in the near future and simplify the official install process. |
Sure! In that case, I'd be happy to close the PR on |
Yes. Thanks for making the contribution! |
@xster fwiw that's not necessary. Formulae in Homebrew/homebew-core get upgraded within hours of upstream releases since we run |
@xster / @briankung shlock's behavior in brew is a little surprising to me. It's not like much special is going on here: https://opensource.apple.com/source/shell_cmds/shell_cmds-118/shlock/shlock.c.auto.html openloop:
if ((fd = open(tempname, O_RDWR|O_CREAT|O_EXCL, 0644)) < 0) { That should always be valid to do on a POSIX filesystem -- well, unless you've set chflags on the directory to prevent it from being written:
If something in homebrew or the way you're setting it up does that, fixing shlock isn't going to cut it because you'll then fail when other write operations are inevitably attempted in the cache. If adding this line: chflags -R nouchg "$FLUTTER_ROOT/bin/cache" here fixes it, you've got a chflags problem and probably should deal with that somehow. Somehow, bin/cache may already exist at the point you first run flutter (maybe you're starting with a binary build of flutter? Those have cache-premade and so they'll pass the mkdir fine, but you won't be able to write to the cache). [edited to fix chflags] |
@jcollins-g Ah, my unix-fu isn't up to snuff - I didn't know about |
I added the line as follows: diff --git a/bin/flutter b/bin/flutter
index 079c3f94d..1b7e06f43 100755
--- a/bin/flutter
+++ b/bin/flutter
@@ -39,6 +39,7 @@ function _rmlock () {
function upgrade_flutter () {
mkdir -p "$FLUTTER_ROOT/bin/cache"
+ chflags -R nouchg "$FLUTTER_ROOT/bin/cache"
# This function is executed with a redirect that pipes the source of
# this script into file descriptor 3. And the test I missed something you said earlier:
I think I am using a binary build of flutter. It's the zip from https://flutter.io/setup-macos/#get-sdk. Since I was curious, I deleted the I'm not too familiar with Unix permissions, but it looks like I do need $ pwd && echo && ls -al bin
/usr/local/Cellar/flutter/0.3.1-beta
total 32
drwxr-xr-x 5 briankung admin 160 May 4 10:01 .
drwxr-xr-x 26 briankung admin 832 May 4 09:53 ..
-r-xr-xr-x 1 briankung admin 6892 May 4 10:01 flutter
-r--r--r-- 1 briankung admin 6338 May 4 09:52 flutter.bat
drwxr-xr-x 8 briankung admin 256 May 4 09:52 internal Copying the directory into my home directory assigns it the |
Thanks for the detailed response @briankung. I could dive further into this with you, but it sounds like the fundamental bug is that we can't guarantee writeability into bin/cache under the flutter installation by regular users and Flutter assumes this. Most Unix packages separate the cached bits they manage from the binary installation. Flutter's packaging method is a bit unorthodox in that the cached bits include most of the binary installation. Homebrew, apt-get, virtually all package managers and operating systems will have some combination of permissions, chroot during build, chattr/chflags, etc to try to prevent installed packages from being modified by regular users. I think the right thing to do here might be to have a flag set in a file that locks the flutter cache as read-only, and make flutter's built-in update tools respect it. That way we can distinguish between user-configuration error and the user using an installed package, and display appropriate errors. Or, more simply, we could just check for cache writeability and skip it if we can't write to the cache. |
@xster's original suggestion might be enough if the rest of the tools already support this. which sounds like it might be the case. |
I've done a little more digging. It looks like we mostly do not need to write to FLUTTER_ROOT and its subdirectories. However, there are exceptions that look likely to result in crashes: The shlock we're running into here is definitely one. Additionally, the preference for a flutter root pub cache looks suspicious to me -- unless pub is coded to handle this case that's probably not going to work for cases where a developer wants to use a different package, either. Given that I found this many little issues right away, I think to fix this for good we probably need to add running integration tests using a read-only FLUTTER_ROOT and track down any little one-offs like this. That'll also keep this from cropping up again as it is really easy as a Flutter developer to accidentally introduce something like this. |
+1 on testing with read-only root |
This comment has been minimized.
This comment has been minimized.
@CAoTx Flutter's site doesn't have any ads on it, and I have no problems downloading with ad blockers installed. Perhaps your custom adblock filters are too restrictive? The site itself is open source, if you want to see how to adjust your filters. Another alternative is to use |
Onboarding new macOS user to flutter development and the installation process is archaic and confusing at best. |
Since this issue has been labeled with P6, which is the lowest priority possible, I guess it won't be solved anytime soon? It's pretty funny, since this is one of the most commented and active issues in repository. |
@timsneath is there any way we can get more transparency into how these community requests are prioritized? |
https://github.com/flutter/flutter/wiki/Triage Although our teams do not currently have bandwidth to take on this issue, that doesn't mean someone else can't. This would be a medium/large endeavor, but should be doable by a motivated contributor. There are a bunch of questions I could imagine need answering here:
Happy to argue about priorities (maybe in another forum), but I'd encourage looking through what other bugs are labeled higher priority than this one. Flutter has a lot of users and from those a lot of (sometimes urgent) requests. We try to address them in the order of making the most impact towards our/users goals. |
@eseidelGoogle Thanks for the clarification, and the strategy sketch, it is very much appreciated and super empowering! |
To answer the question about updating I think if the regular |
The formula could also just download the git repository and run the commands for a user. Formulas don't have to just install binaries. |
As a reference, this is how rustup does: rustup, the toolchain manager of the Rust programming language, it can be installed by running a installing script (standalone installation) or installed from a OS package manager. When you want to upgrade rustup, you can run I think the best way for flutter is to adopt similar implementation as rustup does, but this is a huge work (need to refactor many things to let flutter can managed by a system package manager) and may requires the help from core team members of flutter, so I just give my suggestions here and I won't expect this can be done soon. |
Yeah it sounds waaaaay more complicated than the alleged 10 liner that was referenced earlier in this thread. |
TIL there are more discussion on this going on: http://flutter.dev/go/sdk-per-platform-installers |
Homebrew Formulae https://formulae.brew.sh/cask/flutter |
I've used this homebrew cask to install Flutter on a fresh BigSur install and it has worked flawlessly so far ; it has been a month. |
There is an unofficial formulae that always installs the latest version. https://github.com/flschweiger/homebrew-flutter |
So... are we done? |
Latest status here is that nobody working on Flutter's release processes currently has expressed an interest in implementing this. We don't really see this as a high priority compared to our other release-related work (such as working towards SLSA compliance) since there are a number of other mechanisms for obtaining Flutter today. That said, we recognize that homebrew is a pretty idiomatic way of getting software for developers on macOS, and so the request is quite valid. If anyone would be interested in implementing an official homebrew installation path, the best thing to do would be to reach out on the #hackers-releases channel of our Discord (see the contributing docs for details). Implementing it would require integrating into our release pipeline, so familiarity with that would be extremely helpful. It would also require carefully negotiating how Flutter's primary distribution mechanism (shipping the |
By the way, https://github.com/fluttertools/fvm does support install via brew: |
Latest update: #14050 (comment)
A description of the desired user experience: #14050 (comment)
Didn't find any existing issues on this. Opening for tracking.
Let flutter be
brew install flutter
able.The text was updated successfully, but these errors were encountered: