Setting Up Your New MacBook(Apple Silicon) for Flutter and Swift Development
A Step-by-Step Guide
- Install Terminal https://ohmyz.sh/
// Run this in terminal
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Home Brew https://brew.sh/
// For install Home brew paste this code in terminal and enter password
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Setup Flutter
Follow this step https://docs.flutter.dev/get-started/install/macos
- First, install this in the terminal macOS
$ sudo softwareupdate --install-rosetta --agree-to-license
- Select and copy that Path like image above proses II, paste in a new line, and enter.
$ (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/user/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- If homebrew has already been installed, now install Flutter SDK installation bundle to get the latest stable release of the Flutter SDK
Extract the file ‘flutter.zip’ and move the folder to the desired location. example move to the main user folder like /Users/user/flutter, after getting the path file bin /Users/user/flutter/bin for tool path, and follow this step
//
$ nano .zprofile
- Put the example of this code like the above image
// from doc
$ export PATH="$PATH:`pwd`/flutter/bin"
// example how to use
$ export PATH="$PATH:/Users/user/flutter/bin"
- To see what changed in the file zprofile you can use this
$ cat .zprofile - Use Flutter Doctor to check what is missing from this Flutter installation.
$ flutter doctor
In my case after running Flutter Doctor minus Xcode and Android Studio install and download those tools
- Download Xcode in App Store https://apps.apple.com/id/app/xcode/id497799835?mt=12
- Download Android Studio
https://developer.android.com/studio - follow the instructions to fix the error
// follow instruction to fix the error
$ sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
$ sudo xcodebuild -runFirstLaunch
- When you finish installing and fixing CocoaPods it looks like this, now need to install Android SDK in Android Studio.
- Then also follow this tutorial to fix the Android SDK
- Now run Android license, and it will be complete
$ flutter doctor --android-licenses
Setup Swift (iOS development)
Here is some setup for installing tools for iOS development
- Xcode install
- Install https://cocoapods.org/
$ sudo gem install cocoapods
- Install ruby after installing CocoaPods
There is an error installing CocoaPods need to install RubyGems first and check ruby version using “ $ ruby -v”
// cek version
$ ruby -v
// instal/ update RubyGems
$ sudo gem install drb -v 2.0.5
- after that try installing “sudo gem install cocoapods” again
- There need to install activesupport and installation it.
$ sudo gem install activesupport -v 6.1.7.6
- after that (activesupport) try to install “sudo gem install cocoapods” again, now it should be okay.
Install Git
Instal using “brew install git”
$ brew install git
- Once Git is installed, the first thing you have to do is set your username and email address. This is important because every Git commit will use this information.
$ git config - global user.name "Your username"
$ git config - global user.email "emailanda@example.com"
// Next
$ ls -al ~/.ssh
$ eval "$(ssh-agent -s)"
$ cd
$ cd .ssh
$ ls
id_ed25513 id_ed25513.pub known_hosts
// "id_rsa" this example using example "id_ed25513"
$ ssh-add ~/.ssh/id_ed25513
$ cat id_ed25513.pub
ssh-ed25513 AxAAC3NzaC1lXXXNTE5AxAIXXXKYcaOXXXX97WtZsYzYb03pAJaRi+/YkqG/0IMM useremail@gmail.com
:wq
Copy and paste in your GitHub ssh key, for more details you can see in the video.
Install Xcode Select
Use this “sudo xcode-select -s /Applications/Xcode.app/Contents/Developer”
➜ main git:(development) ✗ xed .
xcode-select: error: tool 'xed' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
➜ main git:(development) ✗ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Confirm Execution: This Sudo Command requires admin rights. Are you sure you wish to proceed?
Yes/No: yes
➜ main git:(development) ✗ xed .
Optional: Install Python
Download here https://www.python.org/downloads/, and follow this tutorial
Tools Should to download
Main Tools
Support Tools
=====================================
Transform Your Ideas into Reality with Expert iOS & Flutter Development! 🚀 Are you looking to bring your app concept to life? I specialize in crafting exceptional iOS and Flutter applications that stand out in the digital world. Let’s collaborate to turn your vision into a stunning, functional app. Contact me today to start your app development journey!”
Hire me -> https://www.upwork.com/freelancers/~01b22fa418e8c595b9