What do you need to do?
- Download Google Chrome (as most people have it on their laptop, so I’ll skip this)
- Download Flutter SDK
- Download VS Code
- Download Xcode
- Download Android Studio
Download Flutter SDK
- Go to https://docs.flutter.dev/release/archive?tab=macos
- Download versions under Stable Channel (macOS)
-
x64
for Mac with Intel chip;arm64
for Mac with Apple Silicon - Run these 2 lines to create a folder called directory
# Go to your users folder on mac
$ cd /Users/your_mac_username
# You can name folder to other than "Developement".
# This is just my suggestion.
$ mkdir Development
- Move the flutter zip to this folder, then unzip it (Once unzipped, you can trash that)
- Don’t remove this Flutter folder as long as you’re still developing with Flutter ~ Your Mac needs this!
Setup Flutter Path
- What is the path? Why do we need to set it up? See here.
- Create a
~/.zshenv
file on your computer
# Create a zsh environment
$ create'~/.zshenv'
- Run this line to edit this file
# This will let you edit your `zshenv` file
$ vim ~/.zshenv
# Press i on your keyboard to enable editing mode
- Paste this line in the file
export PATH=$HOME/Development/flutter_3.22.0/bin:$PATH
# Press esc on your keyboard to close editing mode
# Type :wq (press one key at a time) to quit editing page
# Press enter on your keyboard
- Run this line
# This refreshes the zsh environment
$ exec $SHELL
Install Homebrew
- Open the terminal and run this
$ /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
Install iTerm2 (Optional)
This is to make the Terminal easier to read.
I highly recommend doing this if you're new to software development.
brew install iterm2
- add iTerm2 to your zsh shell environment
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/rubyc/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Run this command on the terminal
$ exec $SHELL
Setup Xcode & License
If using MacBook Apple Silicon, you need to run this line. For MacBook with Intel, you can skip this line.
$ sudo softwareupdate --install-rosetta --agree-to-license
- Run these 2 lines to complete the Xcode license & setup
$ sudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch'
$ sudo xcodebuild -license
Install rbenv (Ruby version manager)
In the next section, when installing Cocoapods, you'll need Ruby setup on your MacBook. Although MacBook, by default, comes with Ruby installed, the Ruby version is old.
Installing Cocoapods will require a higher Ruby version. You'll learn how to update it in the section after this.
$ brew install rbenv
- Run this line to edit ~/.zshrc file
$ vim ~/.zshenv
- If you don’t have this file on your computer, run this to create it
$ create'~/.zshrc'
- Open ~/.zshrc and add these 2 lines
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
- Run this command on the terminal
$ exec $SHELL
- Upgrade Ruby version on MacBook
- Check the Ruby versions that can be installed (only stable versions are displayed)
$ rbenv install -l
- Install Ruby with the specified version.$ rbenv install 3.2.2
$ rbenv install 3.2.2
- Change Ruby version for Global env
$ rbenv global 3.2.2
- Check Ruby version
$ rbenv version
# Expected Return output (your version may be higher than mine)
>> 3.2.2 ( set by / home / account /. rbenv / version )
- Check the Ruby version on your computer. If the output is the same as below, it means good to go to the next step.
$ ruby -v
# Expected output
>> ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin23]
Android SDK Manager Install
- Open Android Studio
- Go to Settings >> Search sdk >> Select Android SDK
- Go to SDK Tools Tab
- Download and select Android SDK Command-line Tools (latest)
- Click Apply, and wait for the download to be finish
- Then, you can run this
$ flutter doctor --android-licenses
Check Development Setup
- run
flutter doctor
orflutter docotor -v
(to see more details) - Btw, if using Android Studio preview, Flutter won’t be able to capture version numbers. That’s normal. (See https://github.com/flutter/flutter/issues/140575)
Xcode Useful Tools (Optional)
- DB Browser for SQLite (Visualize CoreData DB)
$ brew install --cask db-browser-for-sqlite
- Xcodes (manage Xcode versions on Mac)
$ brew install --cask xcodes
References
Flutter Official Installation Doc
Ruby Installations
- https://note.com/naiport/n/n97d5dda4e04e
- https://etrex.tw/free_chatbot_book/mac_dev/ruby.html
- https://qiita.com/kiharito/items/240911cc43bb9a1f4356
- https://arc.net/l/quote/yoziigcc
Homebrew, iTerms & oh-my-zsh Installation
Android Studio SDK Manager
Top comments (1)
In your first code snippet,
mkdr
should bemkdir
. I didn't look at the rest.