Files
FocusBuddy/MACOS_BUILD_GUIDE.md
袁天才 8c61688a26 fix bug
2025-11-23 21:00:47 +08:00

89 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# macOS 编译测试指南
## 快速开始
```bash
cd /Users/yuantiancai/work/FocusBuddy
flutter pub get
flutter run -d macos
```
## 环境要求
### Flutter
Flutter 已安装在 `/Users/yuantiancai/sdk/flutter`
```bash
# 添加到 PATH
export PATH="$PATH:$HOME/sdk/flutter/bin"
source ~/.zshrc
```
### Xcode
从 Mac App Store 安装 Xcode然后
```bash
sudo xcodebuild -license accept
```
### CocoaPods
使用 rbenv 安装 Ruby 3.x 和 CocoaPods
```bash
# 安装 rbenv
brew install rbenv ruby-build
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
source ~/.zshrc
# 安装 Ruby 3.3.8
rbenv install 3.3.8
rbenv global 3.3.8
# 安装 CocoaPods
gem install cocoapods
```
## 编译运行
```bash
# macOS 桌面
flutter run -d macos
# iOS 模拟器
open -a Simulator
flutter run -d ios
# Release 版本
flutter build macos --release
# 输出build/macos/Build/Products/Release/focus_buddy.app
```
## 常见问题
### CocoaPods 错误
```bash
cd ios && pod install && cd ..
flutter clean && flutter pub get
```
### 构建缓存问题
```bash
flutter clean
flutter pub get
```
### Xcode 签名
打开 `ios/Runner.xcworkspace`,在 "Signing & Capabilities" 配置开发团队
## 开发提示
运行时快捷键:
- `r` - 热重载
- `R` - 热重启
- `q` - 退出
代码检查:
```bash
flutter analyze
flutter test
```