Setting Up Your New MacBook(Apple Silicon) for Flutter and Swift Development

Jerry PM
5 min readJan 2, 2024

A Step-by-Step Guide

// Run this in terminal
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.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
Author: proses I “sudo softwareupdate”
Author: proses II “sudo softwareupdate”
  • 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
Author: example 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

// 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
Author: Result in Just 1 issue left
  • 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

$ 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
Author: failed to install CocoaPods
  • after that try installing “sudo gem install cocoapods” again
Author: Active Support, Still failed to install CocoaPods
  • 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.
Author: CocoaPods did install

Install Git

Instal using “brew install git”

$ brew install git
Author: Brew install
  • 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.

Source: Hackages Learning

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

--

--