Flutter/Dart第01天:Dart安装和初体验

打印 上一主题 下一主题

主题 979|帖子 979|积分 2937

本博客原地址: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不稳定容易失败,重试几次即可:
  1. SZH-MacBook:~ shizihu$ brew tap dart-lang/dart
  2. Running `brew update --auto-update`...
  3. ==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:61029cec31c68a1fae1fa90fa876adf43d0becff777da793f9b5c5577f00567a
  4. ################################################################################### 100.0%
  5. ==> Pouring portable-ruby-2.6.10_1.el_capitan.bottle.tar.gz
  6. ==> Homebrew collects anonymous analytics.
  7. Read the analytics documentation (and how to opt-out) here:
  8.   https://docs.brew.sh/Analytics
  9. No analytics have been recorded yet (nor will be during this `brew` run).
  10. Installing from the API is now the default behaviour!
  11. You can save space and time by running:
  12.   brew untap homebrew/core
  13. ==> Downloading https://formulae.brew.sh/api/formula.jws.json
  14. ################################################################################### 100.0%
  15. ==> Downloading https://formulae.brew.sh/api/cask.jws.json
  16. ################################################################################### 100.0%
  17. ==> Tapping dart-lang/dart
  18. Cloning into '/usr/local/Homebrew/Library/Taps/dart-lang/homebrew-dart'...
  19. remote: Enumerating objects: 3737, done.
  20. remote: Counting objects: 100% (1491/1491), done.
  21. remote: Compressing objects: 100% (387/387), done.
  22. remote: Total 3737 (delta 1242), reused 1301 (delta 1098), pack-reused 2246
  23. Receiving objects: 100% (3737/3737), 674.85 KiB | 127.00 KiB/s, done.
  24. Resolving deltas: 100% (2518/2518), done.
  25. 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
[code]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/dartWarning: 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 --installAlternatively, manually download them from:  https://developer.apple.com/download/all/.You should download the Command Line Tools for Xcode 14.2.==> CaveatsPlease note the path to the Dart SDK:  /usr/local/opt/dart/libexec==> Summary
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

勿忘初心做自己

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表