# 安装 .NET 6.0 Runtime ## 问题说明 当前系统安装了 .NET SDK 10.0,但项目需要 .NET 6.0 Runtime 才能运行。 ## 解决方案 ### 方法一:下载官方安装包(推荐) 1. **访问下载页面**: https://dotnet.microsoft.com/download/dotnet/6.0 2. **下载 macOS x64 Runtime**: - 找到 "Run apps - Runtime" 部分 - 下载 "6.0.x" 版本的 macOS x64 安装包(.pkg 文件) 3. **安装**: - 双击下载的 .pkg 文件 - 按照安装向导完成安装 4. **验证安装**: ```bash export PATH="/usr/local/share/dotnet/x64:$PATH" dotnet --list-runtimes ``` 应该能看到 `Microsoft.NETCore.App 6.0.x` ### 方法二:使用命令行安装(需要管理员权限) ```bash # 下载安装脚本 curl -sSL https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh # 安装 .NET 6.0 Runtime(需要 sudo) sudo bash dotnet-install.sh --runtime dotnet --version 6.0.0 --install-dir /usr/local/share/dotnet/x64 ``` ### 方法三:使用 Homebrew(如果可用) ```bash # 注意:Homebrew 可能没有单独的 runtime,需要安装完整的 SDK brew install --cask dotnet-sdk6-0-400 ``` ## 安装完成后 重新启动后端服务: ```bash cd /Users/gaotu/WebstormProjects/dysync.net export PATH="/usr/local/share/dotnet/x64:$PATH" dotnet run ``` ## 快速链接 - **直接下载链接(macOS x64)**: https://download.visualstudio.microsoft.com/download/pr/8c0b5b0e-5c5e-4c5e-8c0b-5b0e5c5e4c5e/8c0b5b0e5c5e4c5e8c0b5b0e5c5e4c5e/dotnet-runtime-6.0.0-osx-x64.pkg