Skip to content

Instantly share code, notes, and snippets.

@AlexanderCollins
Created June 12, 2018 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AlexanderCollins/22d5a8cae2f0fc1193368b2e6f77a570 to your computer and use it in GitHub Desktop.
Save AlexanderCollins/22d5a8cae2f0fc1193368b2e6f77a570 to your computer and use it in GitHub Desktop.
Install Flutter On Mac (Installs brew and wget as well)
#!/bin/bash
# install brew if not installed
if [[ $(command -v brew) == "" ]]; then
echo "Installing Hombrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# check if wget is installed
if brew ls --versions myformula > /dev/null; then
# The package is installed thus do nothing.
else
# The package is not installed, install it
echo "Installing wget"
brew install wget
fi
# create and move to flutter directory
mkdir ~/flutter
cd ~/flutter
# download the flutter macos package in zip file
wget https://storage.googleapis.com/flutter_infra/releases/beta/macos/flutter_macos_v0.4.4-beta.zip
# unzip the package
unzip ~/flutter/flutter_macos_v0.4.4-beta.zip
# add flutter to path in zsh rc file
echo "export PATH=$(pwd)/flutter/bin:$PATH" >> ~/.zshrc
# add flutter to path in bash profile
echo "export PATH=$(pwd)/flutter/bin:$PATH" >> ~/.bash_profile
# export flutter to path in preperation for upgrade
export PATH=$(pwd)/flutter/bin:$PATH
# return to home path
cd ~/
# upgrade flutter
flutter upgrade
# notify complete
echo "\033[92mFlutter has been installed and upgraded, you're welcome.\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment