dart-lang / homebrew-dart

Dart team's official tap for homebrew.
BSD 3-Clause "New" or "Revised" License
155 stars 52 forks source link

Flutter install fails when dart is already installed #85

Closed andig closed 1 year ago

andig commented 3 years ago
❯ which flutter
flutter not found

~/htdocs/evcc master* ⇣⇡ 6s
❯ which dart
/usr/local/bin/dart

~/htdocs/evcc master* ⇣⇡
❯ brew install flutter                              
==> Downloading https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_1.22.4-stable.zip
Already downloaded: /Users/andig/Library/Caches/Homebrew/downloads/10b169e1dde563ba8ca7738adf52153d5f9d56a7353b49ebb8b6d0a731360871--flutter_macos_1.22.4-stable.zip
==> Installing Cask flutter
==> Purging files for version 1.22.4 of Cask flutter
Error: It seems there is already a Binary at '/usr/local/bin/dart'.

~/htdocs/evcc master* ⇣⇡ 1m 22s
❯ brew remove dart
Uninstalling /usr/local/Cellar/dart/2.10.4... (510 files, 429MB)

~/htdocs/evcc master* ⇣⇡
❯ brew install flutter
==> Downloading https://storage.googleapis.com/flutter_infra/releases/stable/macos/flutter_macos_1.22.4-stable.zip
Already downloaded: /Users/andig/Library/Caches/Homebrew/downloads/10b169e1dde563ba8ca7738adf52153d5f9d56a7353b49ebb8b6d0a731360871--flutter_macos_1.22.4-stable.zip
==> Installing Cask flutter
==> Linking Binary 'dart' to '/usr/local/bin/dart'.
==> Linking Binary 'flutter' to '/usr/local/bin/flutter'.
🍺  flutter was successfully installed!

It would be nicer experience if Flutter would just us the existing dart. As far as I can tell both where installed from this tap:

❯ brew tap 
adoptopenjdk/openjdk
azure/functions
dart-lang/dart
golangci/tap
homebrew/cask
homebrew/cask-fonts
homebrew/core
homebrew/services
minio/stable
sass/sass
saulpw/vd
athomas commented 3 years ago

The Flutter install seems to be a community maintained cask coming from: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/flutter.rb

So the tap that supplies it is homebrew/cask. It's kinda cool how simple the cask is and perhaps it would be better to structure the formula like that. However, it lacks support for different channels, architectures (not sure; the flutter tool might pull in the right binaries) and older versions.

athomas commented 3 years ago

As for Flutter using the existing Dart, that's unfortunately not possible. Flutter is tightly bound to a specific Dart version. The two formulas are simply incompatible.