-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Adds PATH for macOS #10031
Adds PATH for macOS #10031
Changes from all commits
d4d7ef6
c9ac009
efc4bec
3956e4b
02a1e6b
7d9215f
66227c8
35b1737
bf1bb02
5a98236
60962b3
698fd89
efb4237
260add0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,9 @@ | |
|
||
{% assign os = include.os %} | ||
{% assign osl = include.os | downcase %} | ||
{% assign target = include.target %} | ||
{% case os %} | ||
{% when 'Windows' -%} | ||
{% when "Windows" -%} | ||
{% assign unzip='Extract-Archive' %} | ||
{% assign path='C:\dev\' %} | ||
{% assign terminal='PowerShell' %} | ||
|
@@ -39,13 +40,18 @@ | |
{% assign mv1 = 'mv ' | append: dirdl %} | ||
{% endcase -%} | ||
|
||
To install Flutter, | ||
download the Flutter SDK bundle from its archive, | ||
move the bundle to where you want it stored, | ||
then extract the SDK. | ||
|
||
1. Download the following installation bundle to get the latest | ||
{{site.sdk.channel}} release of the Flutter SDK. | ||
|
||
{% if os=='macOS' %} | ||
|
||
| Intel | | <span class="apple-silicon">Apple Silicon</span> | | ||
|-------| | ---------------| | ||
| Intel Processor | | Apple Silicon | | ||
|-----------------|-|---------------| | ||
| [(loading...)](#){:.download-latest-link-{{osl}}.btn.btn-primary} | | [(loading...)](#){:.download-latest-link-{{osl}}-arm64.apple-silicon.btn.btn-primary} | | ||
|
||
{% else %} | ||
|
@@ -84,6 +90,9 @@ | |
|
||
[SDK archive]: {{site.url}}/release/archive | ||
|
||
{% if os == 'Windows' %} | ||
{% include docs/install/reqs/windows/set-path.md terminal=terminal %} | ||
{% endif %} | ||
{% case os %} | ||
{% when 'Windows' %} | ||
{% include docs/install/reqs/windows/set-path.md terminal=terminal target=target %} | ||
{% when 'macOS' %} | ||
{% include docs/install/reqs/macos/set-path.md terminal=terminal target=target dir=dirinstall %} | ||
{% endcase %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if it's just me but this structure is hard to review with all of these includes. I've noticed that the size of the Includes are great for reusable snippets of instructions but might have diminishing returns if we use them too much. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be on first pass, but future updates may be easier. Most of these types of pages get a lot of reuse as most (~75%) of the content is the same for all 4 development platforms. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's really hard for me to follow what's going on. I have to jump around from file to file rather than just read it in-line. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,19 @@ | |
### Use VS Code to install Flutter | ||
{:.no_toc} | ||
|
||
#### Start Flutter install | ||
To install Flutter using these instructions, verify that | ||
you have installed [Visual Studio Code][] | ||
{{site.appmin.vscode}} or later and the [Flutter extension for VS Code][]. | ||
|
||
#### Prompt VS Code to install Flutter | ||
{:.no_toc} | ||
|
||
1. Open VS Code. | ||
1. Launch VS Code. | ||
|
||
1. To open the Command Palette, | ||
1. To open the **Command Palette**, | ||
press <kbd>{{special}}</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd>. | ||
|
||
1. In the Command Palette, type `flutter`. | ||
1. In the **Command Palette**, type `flutter`. | ||
|
||
1. Select **Flutter: New Project**. | ||
|
||
|
@@ -26,10 +30,12 @@ | |
{:type="a"} | ||
1. If you have the Flutter SDK installed, click **Locate SDK**. | ||
|
||
1. If you do not have the Flutter SDK installed, click **Download SDK**. | ||
1. If you do not have the Flutter SDK installed, | ||
click **Download SDK**. | ||
|
||
This option sends you the Flutter install page if you have not installed | ||
Git for Windows as directed in the [development tools prerequisites][]. | ||
This option sends you the Flutter install page if you have not | ||
installed Git {% if os == "Windows" %}for Windows {% endif %}as directed in | ||
the [development tools prerequisites][]. | ||
|
||
1. When prompted **Which Flutter template?**, ignore it. | ||
Press <kbd>Esc</kbd>. | ||
|
@@ -128,3 +134,5 @@ | |
1. Restart VS Code. | ||
|
||
[development tools prerequisites]: #development-tools | ||
[Visual Studio Code]: https://code.visualstudio.com/docs/setup/mac | ||
[Flutter extension for VS Code]: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused link? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
When you run the current version of `flutter doctor`, | ||
it might list a different version of one of these packages. | ||
If it does, install the version it recommends. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
{{site.alert.important}} | ||
When installing on an [Apple Silicon Mac][], | ||
install the Rosetta translation environment. | ||
Some components require the [Rosetta][need-rosetta]. | ||
Some Flutter components require the | ||
[Rosetta 2 translation process][need-rosetta] | ||
on Macs running [Apple silicon][]. | ||
To run all Flutter components on Apple silicon, | ||
install [Rosetta 2][rosetta]. | ||
|
||
```terminal | ||
sudo softwareupdate --install-rosetta --agree-to-license | ||
``` | ||
{{site.alert.end}} | ||
```terminal | ||
$ sudo softwareupdate --install-rosetta --agree-to-license | ||
``` | ||
|
||
[Apple Silicon Mac]: https://support.apple.com/en-us/HT211814 | ||
[Apple silicon]: https://support.apple.com/en-us/HT211814 | ||
[rosetta]: https://support.apple.com/en-us/HT211861 | ||
[need-rosetta]: {{site.repo.this}}/pull/7119#issuecomment-1124537969 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% assign terminal=include.terminal %} | ||
{% assign target = include.target %} | ||
{% assign dir = include.dir %} | ||
|
||
### Add Flutter to your `PATH` | ||
{:.no_toc} | ||
|
||
To run Flutter commands in {{terminal}}, | ||
add Flutter to the `PATH` environment variable. | ||
This guide presumes your [Mac runs the latest default shell][zsh-mac], `zsh`. | ||
Zsh uses the `.zshenv` file for [environment variables][envvar]. | ||
|
||
1. Launch your preferred text editor. | ||
|
||
1. If it exists, open the Zsh environmental variable file `~/.zshenv` | ||
in your text editor. If it doesn't, create `~/.zshenv`. | ||
|
||
1. Copy the following line and paste it at the end of your `~/.zshenv` file. | ||
|
||
```conf | ||
export PATH=$HOME/development/flutter/bin:$PATH | ||
``` | ||
|
||
1. Save your `~/.zshenv` file. | ||
|
||
1. To apply this change, restart all open terminal sessions. | ||
|
||
If you use another shell, | ||
check out [this tutorial on setting your PATH][other-path]. | ||
|
||
[zsh-mac]: https://support.apple.com/en-us/102360 | ||
[envvar]: https://zsh.sourceforge.io/Intro/intro_3.html | ||
[other-path]: https://www.cyberciti.biz/faq/unix-linux-adding-path/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmagman Why do we recommend Homebrew, but the CocoaPods Getting Started guide says to use
gem install
with the system Ruby installation?@atsansone It would be great if we can lean more on the CocoaPods documentation here. At the very least, we should try to match what they recommend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I included Homebrew is that it was included in a previous version of this doc for the reasons stated in the Software requirements: Homebrew handles chipset and permissions issues for you. I would love to avoid:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnpryan I wouldn't have suggested Homebrew, I wasn't a reviewer on #9736.
https://docs.flutter.dev/get-started/install/macos/mobile-ios#install-cocoapods currently sounds like Homebrew is a requirement to do Flutter iOS development and it just isn't. cc @christopherfujino
I don't use Homebrew to manage Ruby or CocoaPods. I use the built in Ruby version to macOS and I follow CocoaPod's own installation instructions. For the purpose of this doc I would personally just point them to https://guides.cocoapods.org/using/getting-started.html#installation and call it a day instead of trying to replicate dependency's installation instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also not a fan of Homebrew and skip any steps involving it. Leaning on Cocoapods own installation instructions and the options there seems good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got lost searching through the git history, but TL;DR we used to recommend brew install cocoapods, but this caused pain for our users, and is NOT the official way to install this, so we standardized on
gem install cocoapods
across the tool and website as our official recommendation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is aligned with what the tool tells users to do if we detect it's either missing or broken: https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/macos/cocoapods.dart#L50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most any explanation I've consulted doesn't recommend the default macOS install of Ruby. We used Homebrew elsewhere, so it seemed better to have one way to install everything instead of one way for this app, another for this other app, etc. Think as a new user: keep it simple.
We refer to Homebrew in about as many pages in the public docs: around 1-2 times each.
Looking at this as a new user, I'd like to recommend simple, consistent ways to handle installs wherever possible. Homebrew offers that option.
Further, the CocoaPods install docs themselves are out of date (referring to
bash_profile
, for example).Although, @christopherfujino , your point about what exists in the code makes sense and may need a future revisit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmagman : Understood that CocoaPods is not required to build iOS apps for Flutter. It's required to build Flutter plugins for iOS apps, right? We could make that note, but not in a Getting Started. I would then need to add an additional section or page later to cover that off. What say you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CocoaPods is required as soon as you add a plugin. I believe in the docs that used to be called out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still is. ;)