ios setup

2023-01-09 · 2 min read

install Xcode #

Either download the app directly from https://developer.apple.com/xcode/download/ or install it from the Mac App Store.

Once installed, run

$ sudo xcode-select \
	--switch /Applications/Xcode.app/Contents/Developer
$ sudo xcodebuild -runFirstLaunch

install CocoaPods #

From the "Sudo-less Install" section: https://guides.cocoapods.org/using/getting-started.html#installation

Ensure your .bashrc contains something like:

export GEM_HOME=$HOME/.local/gem
GEM_BIN=$GEM_HOME/bin

export PATH=$PATH:$GEM_BIN

Then install the cocoapods gem:

# sanity check
$ gem --version
3.0.3.1

$ gem install cocoapods

# sanity check
$ pod --version
1.11.3

ensure the iOS Simulator app works #

Search for "Simulator" in Spotlight and then open it. An emulated iPhone should pop up after a minute or so.

If the Simulator app isn't there (which it wasn't for me, even after installing Xcode), try opening and running a sample iOS app in Xcode first.

running a flutter app #

Run the iPhone simulator or attach a real device. Once hooked up, it should be visible in flutter devices:

$ flutter devices
3 connected devices:

Pixel 5a (mobile)  android-arm64 • Android 13 (API 33)
iPhone 14 Pro (mobile)  ios • iOS-16-2 (simulator)
macOS (desktop)  macos • darwin-arm64 • macOS 13.1 darwin-arm

Since I have multiple devices attached, I'll need to also specify which one to run on:

$ flutter run -d iPhone