dart-lang / homebrew-dart

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

Installing Dart 1 #56

Closed johnpryan closed 5 years ago

johnpryan commented 6 years ago

I'm trying to install Dart 1 using homebrew using the new dart@1 formula: https://github.com/dart-lang/homebrew-dart/pull/53

When I run the search command I can see the new formula:

brew search dart@
==> Searching local taps...
dart-lang/dart/dart :heavy_check_mark:       dart-lang/dart/dart@1       dart-lang/dart/dart@2       dartsim

When I run the install command, it installs the formula in a separate directory in the Cellar/ directory:

brew install dart@1 --with-dartium
screen shot 2018-06-25 at 3 21 23 pm

So this doesn't seem very useful AFAICT. I normally run brew switch to switch between new and old versions of homebrew packages (which sets up all of the symlinks for you)

Copying the contents of dart@1/1.24.3 into dart/1.24.3 doesn't work completely (pub and other commands don't work quite right)

How do we use these new formula?

melvinabundo commented 5 years ago

open ~/.bash_profile

Add this line: # export PATH=/usr/local/opt/dart@1/bin:$PATH # Uncomment line to switch to Dart 1.24.3

Every time you want to use Dart 1.24.3, just uncomment the line and restart terminal.

Thank you for your post, it was my starting point for the same issue.

johnpryan commented 5 years ago

@melvinabundo That works.

I'm going to close this issue since it's really not a problem with Dart, but with how homebrew works. Homebrew's switch command will switch between versions in the Cellar/dart/ directory but doesn't support replacing the symlinks with the proper paths pointing to dart@1. I think I worked around this in the past by going into the Homebrew repository on my local machine and reverting it back to a commit hash where Dart 1 was still the latest version.

I think anyone using Dart 1 will end up downloading the SDK manually anyway.

camsteffen commented 5 years ago

Switch to Dart 1

brew unlink dart
brew link -f dart@1

Switch to Dart 2

brew unlink dart@1
brew link dart

or

brew link --overwrite dart

--overwrite only seems to work when switching from 1 to 2