01 MAC shuttle environment setup


Setting up MAC fluent environment

Install domestic image

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

Download fluent

  1. Download fluent
  1. Enter the directory where you want to place the flitter
cd ~/development
  1. Unzip the download file,Remember to change to the version number you downloaded, press y to confirm
unzip ~/Downloads/flutter_macos_v0.5.1-beta.zip

  1. Add fluent to path
export PATH=`pwd`/flutter/bin:$PATH

At this point, you will find that you open a new command line window and runflutter doctor, an error that the flitter does not exist will be reported because the environment variable has not been globally effective

Run fluent

  1. functionflutter doctor

Error details

Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ✗ Android licenses not accepted.  To resolve this, run: flutter doctor
[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin
        code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods
[!] Android Studio (version 4.1)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[!] VS Code (version 1.52.0)
    ✗ Flutter extension not installed; install from
[!] Connected device
    ! No devices available

The above error message tells you that things are not installed, such as Xcode, Android studio, dart and futter plug-ins of Android studio, cocoapods, and flutter plug-ins of vs code are not installed

  1. Xcode installation
  • Search the app store for Xcode and install it
  • Run the following command
  • Running the fluent doctor again will find that the error about Xcode has disappeared
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
sudo gem install cocoapods
  1. Android studio installation

  1. Installation of shuttle plug-in in vs Code
  • Open vscode, click extension, enter fluent, install, and then reopen vscode after installation

  1. Run againflutter doctor, there may still be errors related to Android studio. Run the following command
//Note the Android studio version number
ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1
  1. Run againflutter doctor, this is normal

Environment variable configuration

  • View the environment configuration path path of fluent
echo $PATH
//You can see that the path of the shuttle is

  • Open environment profile
open ~/.bash_profile
  • Or VIM edit
vim ~/.bash_profile
  • If you are editing Bash_ Profile found that the file does not exist
//Create Bash_ Profile file
touch .bash_profile
  • bash_ When the profile file exists, add the following
//Add domestic image
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
//Add the installation path, which is obtained above
export PATH="/Users/name/development/flutter/bin:$PATH"
  • Update environment configuration
source ~/.bash_profile
  • Restart the editor and you will find that

Final Bash_ Profile file

// .bash_profile
# HomeBrew
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
#Name is the name of your computer
export PATH="/Users/name/development/flutter/bin:$PATH"
source ~/.bashrc
# HomeBrew END

GitHub view more articles