
PowerShell 跨平台安装完整指南架构确认、一键安装与手动装包【免费下载链接】PowerShellPowerShell for every system!项目地址: https://gitcode.com/GitHub_Trending/po/PowerShellPowerShell 安装包选错 CPU 架构装完直接跑不起来这是三平台安装里最常见的翻车点。这篇 PowerShell 跨平台安装指南覆盖 Windows、Linux、macOS一行命令确认架构、一键脚本或手动装包、验证与装后配置命令全部可照抄。 装之前一行命令确认系统架构Windows用 Get-ComputerInfo 查架构(Get-ComputerInfo -Property OsArchitecture).OsArchitecture输出64-bit表示 x6432-bit表示 x86ARM 芯片显示ARM64。Linux用 uname -m 查架构uname -m输出x86_64即 x64。macOS用 uname -m 查架构uname -mx86_64是 Intel 芯片arm64是 Apple 芯片按输出选对应安装包。⚡ 最快路径一条命令装好 PowerShell基础安装命令把仓库里的 install-powershell.ps1 下载后运行powershell -ExecutionPolicy ByPass -File install-powershell.ps1 -AddToPathWindows 自带 PowerShell 可直接执行Linux/macOS 需在已有 pwsh 里跑没有就跳到下一节。装完会输出PowerShell has been installed at 安装目录验证命令pwsh -v输出PowerShell version即成功。默认目录Windows 装到%LOCALAPPDATA%\Microsoft\powershellLinux/macOS 装到~/.powershell脚本会自动建/usr/bin/pwshLinux或/usr/local/bin/pwshmacOS软链需要输入 sudo 密码。常用可选参数-Daily装每日构建版-Preview装预览频道版-Destination D:\PS指定安装路径-Quiet静默安装配合-UseMSI使用 离线或指定版本手动安装方案WindowsMSI 安装包到项目 Releases 发布页下载PowerShell-version-win-x64.msi双击走安装向导或命令行静默安装msiexec /i PowerShell-version-win-x64.msi /quietLinux解压加软链sudo mkdir -p /opt/microsoft/powershell/7 sudo tar zxf powershell-version-linux-x64.tar.gz -C /opt/microsoft/powershell/7 sudo ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwshmacOSpkg 双击或解压加软链双击PowerShell-version-osx-x64.pkg弹窗提示未验证开发者时点打开习惯命令行的话sudo tar zxf powershell-version-osx-x64.tar.gz -C /usr/local sudo ln -s /usr/local/pwsh /usr/local/bin/pwsh 装完顺手做的三件配置装模块Install-Module -Name ModuleName -Scope CurrentUser查并启用实验性功能先Get-ExperimentalFeature再Enable-ExperimentalFeature -Name FeatureName编辑启动配置文件notepad $PROFILEWindows或code $PROFILELinux/macOS 装不上或跑不起来时的排查动作架构选错重跑uname -m或Get-ComputerInfo -Property OsArchitecture核对后换包提示pwsh: command not found重建软链sudo ln -s 安装目录/pwsh /usr/bin/pwshmacOS 提示未验证开发者打开系统设置 → 隐私与安全性点仍要打开Linux 报缺库错误先装好 dotnet 运行时和 libicu再重跑安装脚本想深入再看 docs/ 里的构建与调试文档命令开发示例在 docs/cmdlet-example/。现在就敲pwsh【免费下载链接】PowerShellPowerShell for every system!项目地址: https://gitcode.com/GitHub_Trending/po/PowerShell创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考