本博客原地址:https://ntopic.cn/p/2023092301/
Dart的安装方式有几种:一种是下载源代码,然后编译安装;一种是通过包管理工具进行安装。
Dart官方网站分表列出了针对Windows、Linux和MacOS的安装方式:https://dart.dev/get-dart
我下面在个人MacOS上介绍brew
包管理工具安装方法和过程:
安装HomeBrew包管理工具:brew
HomeBrew是MacOS的一个包管理工具,有了它,后面安装、更新、配置等操作就容易多了:https://brew.sh
获取Dart:brew tap dart-lang/dart
本命令作用是获取Dart的安装包列表。由于需要从GitHub拉取包数据,访问GitHub不稳定容易失败,重试几次即可:
SZH-MacBook:~ shizihu$ brew tap dart-lang/dart
Running `brew update --auto-update`...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:61029cec31c68a1fae1fa90fa876adf43d0becff777da793f9b5c5577f00567a
################################################################################### 100.0%
==> Pouring portable-ruby-2.6.10_1.el_capitan.bottle.tar.gz
==> Homebrew collects anonymous analytics.
Read the analytics documentation (and how to opt-out) here:
https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).
Installing from the API is now the default behaviour!
You can save space and time by running:
brew untap homebrew/core
==> Downloading https://formulae.brew.sh/api/formula.jws.json
################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
################################################################################### 100.0%
==> Tapping dart-lang/dart
Cloning into '/usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart'...
remote: Enumerating objects: 3737, done.
remote: Counting objects: 100% (1491/1491), done.
remote: Compressing objects: 100% (387/387), done.
remote: Total 3737 (delta 1242), reused 1301 (delta 1098), pack-reused 2246
Receiving objects: 100% (3737/3737), 674.85 KiB | 127.00 KiB/s, done.
Resolving deltas: 100% (2518/2518), done.
Tapped 22 formulae (53 files, 862.2KB).
安装Dart:brew install dart
从安装日志可以看出:
- Dart安装版本:3.1.2
- Dart安装路径:/usr/local/Cellar/dart/3.1.2
- Dart命令路径:/usr/local/opt/dart/libexec
SZH-MacBook:~ shizihu$ brew install dart
==> Fetching dart-lang/dart/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/stable/release/3.1.2/
################################################################################### 100.0%
==> Installing dart from dart-lang/dart
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences.
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.2.
==> Caveats
Please note the path to the Dart SDK:
/usr/local/opt/dart/libexec
==> Summary
标签:...,初体验,dart,01,shizihu,brew,Homebrew,Dart
From: https://www.cnblogs.com/obullxl/p/NTopic2023092301.html