- Installing PowerShell on macOS
- Supported versions of macOS
- Installation of latest stable release via Homebrew on macOS 10.13 or higher
- Installation of latest preview release via Homebrew on macOS 10.13 or higher
- Installation via Direct Download
- Install as a .NET Global tool
- Binary Archives
- Installing binary archives on macOS
- Installing dependencies
- Uninstalling PowerShell
- Paths
- Installation support
- Dmitry’s Blog: Cloud, PowerShell and beyond
- Run PowerShell on Mac OS X
- Download and Install PowerShell for Mac OX
- Run PowerShell on Mac OS X
- Установка PowerShell в macOS
- Установка последнего стабильного выпуска с помощью Homebrew в macOS 10.13 или более поздней версии
- Установка последнего предварительного выпуска с помощью Homebrew в macOS 10.13 или более поздней версии
- Установка с помощью прямого скачивания
- Установка в качестве глобального средства .NET
- Архивы двоичных файлов
- Установка архивов двоичных файлов в macOS
- Установка зависимостей
- Удаление PowerShell
- Поддержка установки
Installing PowerShell on macOS
PowerShell 7.0 or higher require macOS 10.13 and higher. All packages are available on our GitHub releases page. After the package is installed, run pwsh from a terminal.
PowerShell 7.2 is an in-place upgrade that removes previous versions of PowerShell 6.x and 7.x.
The /usr/local/microsoft/powershell/6 folder is replaced by /usr/local/microsoft/powershell/7 .
If you need to run an older version of PowerShell side-by-side with PowerShell 7.2, install the version you want using the binary archive method.
Supported versions of macOS
The following table is a list of currently supported PowerShell releases and the versions of Windows they are supported on. These versions remain supported until either the version of PowerShell reaches end-of-support or the version of [macOS reaches end-of-support][eol-windows].
- A вњ… indicates that the version of the OS or PowerShell is still supported
- A вќЊ indicates that the version of the OS or PowerShell isn’t supported
- A рџџЎ indicates the version of PowerShell is no longer supported on that version of the OS
- When both the version of the OS and the version of PowerShell have вњ…, that combination is supported
macOS | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
вњ… macOS Big Sur 11.5 | вњ… | вњ… | вњ… |
вњ… macOS Catalina 10.15 | вњ… | вњ… | вњ… |
вњ… macOS Mojave 10.14 | вњ… | вњ… | вњ… |
вњ… macOS High Sierra 10.13 | вњ… | вњ… | вќЊ |
Support of macOS is defined by Apple. For more information, see:
PowerShell is supported on macOS for the following processor architectures:
macOS | 7.0 (LTS) | 7.1 (current) | 7.2 (LTS-preview) |
---|---|---|---|
macOS Big Sur 11.5 | x64 | x64 | x64, Arm64 |
macOS High Sierra 10.13+ | x64 | x64 | x64 |
Installation of latest stable release via Homebrew on macOS 10.13 or higher
There are several ways to install PowerShell on macOS. Choose one of the following methods:
- Install using Homebrew. Homebrew is the preferred package manager for macOS.
- Install PowerShell via Direct Download
- Install from binary archives.
After installing PowerShell, you should install OpenSSL. OpenSSL is needed for PowerShell WSMan remoting.
If the brew command is not found, you need to install Homebrew following their instructions.
Now, you can install PowerShell:
Finally, verify that your install is working properly:
When new versions of PowerShell are released, update Homebrew’s formulae and upgrade PowerShell:
The commands above can be called from within a PowerShell (pwsh) host, but then the PowerShell shell must be exited and restarted to complete the upgrade and refresh the values shown in $PSVersionTable .
Installation of latest preview release via Homebrew on macOS 10.13 or higher
After you’ve installed Homebrew, you can install PowerShell. First, install the Cask-Versions package that lets you install alternative versions of cask packages:
Now, you can install PowerShell:
Finally, verify that your install is working properly:
When new versions of PowerShell are released, update Homebrew’s formulae and upgrade PowerShell:
The commands above can be called from within a PowerShell (pwsh) host, but then the PowerShell shell must be exited and restarted to complete the upgrade. and refresh the values shown in $PSVersionTable .
Installing PowerShell using the Homebrew tap method is also supported for stable and LTS versions.
You can now verify your install
When new versions of PowerShell are released, simply run the following command.
Whether you use the cask or the tap method, when updating to a newer version of PowerShell, use the same method you used to initially install PowerShell. If you use a different method, opening a new pwsh session will continue to use the older version of PowerShell.
If you do decide to use different methods, there are ways to correct the issue using the Homebrew link method.
Installation via Direct Download
PowerShell 7.2 addes support for the Apple M1 processor. Download the install package from the releases page onto your computer. The links to the current versions are:
- PowerShell 7.2-preview.10
- x64 processors — https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.pkg
- M1 processors — https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.pkg
- PowerShell 7.1.4 — https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell-7.1.4-osx-x64.pkg
- PowerShell 7.0.7 — https://github.com/PowerShell/PowerShell/releases/download/v7.0.7/powershell-7.0.7-osx-x64.pkg
You can double-click the file and follow the prompts, or install it from the terminal using the following commands. Change the name of the file to match the file you downloaded.
Install OpenSSL. OpenSSL is needed for PowerShell remoting and CIM operations.
Install as a .NET Global tool
If you already have the .NET Core SDK installed, it’s easy to install PowerShell as a .NET Global tool.
The dotnet tool installer adds
/.dotnet/tools to your PATH environment variable. However, the currently running shell does not have the updated PATH . You should be able to start PowerShell from a new shell by typing pwsh .
Install OpenSSL. OpenSSL is needed for PowerShell remoting and CIM operations.
Binary Archives
PowerShell binary tar.gz archives are provided for the macOS platform to enable advanced deployment scenarios. When you install using this method you must also manually install any dependencies.
Install OpenSSL. OpenSSL is needed for PowerShell remoting and CIM operations.
You can use this method to install any version of PowerShell including the latest:
Installing binary archives on macOS
Download the install package from the releases page onto your computer. The links to the current versions are:
- PowerShell 7.2-preview.10
- x64 processors — https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-x64.tar.gz
- M1 processors — https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.10/powershell-7.2.0-preview.10-osx-arm64.tar.gz
- PowerShell 7.1.4 — https://github.com/PowerShell/PowerShell/releases/download/v7.1.4/powershell-7.1.4-osx-x64.tar.gz
- PowerShell 7.0.7 — https://github.com/PowerShell/PowerShell/releases/download/v7.0.7/powershell-7.0.7-osx-x64.tar.gz
Use the following commands to install PowerShell from the binary archive. Change the download URL to match the version you want to install.
Installing dependencies
OpenSSL is required for PowerShell remoting and CIM operations. You can install OpenSSL via MacPorts if needed.
MacPorts and Homebrew can have problems when used to together on the same system. However, Homebrew does not have a package for OpenSSL 1.0. For more information, see the MacPorts FAQ.
Install the Xcode command-line tools. The Xcode tools are required by MacPorts.
Install MacPorts. If you need instructions, refer to the installation guide.
Update MacPorts by running sudo port selfupdate .
Upgrade MacPorts packages by running sudo port upgrade outdated .
Install OpenSSL by running sudo port install openssl10 .
Link the libraries to make them available to PowerShell:
Uninstalling PowerShell
If you installed PowerShell with Homebrew, use the following command to uninstall:
If you installed PowerShell via direct download, PowerShell must be removed manually:
To remove the additional PowerShell paths, refer to the paths section in this document and remove the paths using sudo rm .
This is not necessary if you installed with Homebrew.
Paths
- $PSHOME is /usr/local/microsoft/powershell/7.1.4/
- User profiles will be read from
/.config/powershell/profile.ps1
/.local/share/powershell/Modules
The profiles respect PowerShell’s per-host configuration. So the default host-specific profile exists at Microsoft.PowerShell_profile.ps1 in the same locations.
PowerShell respects the XDG Base Directory Specification on macOS.
Because macOS is a derivation of BSD, the prefix /usr/local is used instead of /opt . So, $PSHOME is /usr/local/microsoft/powershell/7.1.4/ , and the symbolic link is placed at /usr/local/bin/pwsh .
Installation support
Microsoft supports the installation methods in this document. There may be other methods of installation available from other sources. While those tools and methods may work, Microsoft cannot support those methods.
Источник
Dmitry’s Blog: Cloud, PowerShell and beyond
Dmitry Sotnikov’s view on Cloud, PowerShell, PowerGUI and everything he sees around
Run PowerShell on Mac OS X
As you have probably heard by now, Microsoft has just open-sourced PowerShell and made it available for Linux and Mac OS X. In this blog post, I will take you through the steps to download, install and run PowerShell on a Mac.
Download and Install PowerShell for Mac OX
- Go to PowerShell github project: https://github.com/PowerShell/PowerShell
- Scroll down to the Get PowerShell section and download .pkg:
3. Locate the newly downloaded file in Downloads, right-click it and click Open:
4. You will be warned that this is a file from the Internet and then prompted for your local administrative password, then go through the installation wizard.
Run PowerShell on Mac OS X
PowerShell is a command-prompt in your terminal window, so to start it:
- Start the Terminal application,
- Now you can simply type powershell as a command and this will start the PowerShell engine and move you from the bash prompt ($) to the PowerShell prompt (PS):
If you are new to PowerShell, see the Learning PowerShell page on GitHub.
Источник
Установка PowerShell в macOS
Для работы с PowerShell 7.0 или более поздней версии требуется macOS 10.13 и выше. Все пакеты доступны на нашей странице выпусками GitHub. После установки пакета запустите pwsh из терминала.
PowerShell 7.1 является обновлением на месте, при установке которого PowerShell Core версий 6.x и 7.0 удаляется.
Папка /usr/local/microsoft/powershell/6 заменяется на /usr/local/microsoft/powershell/7 .
Если вам нужно запустить более раннюю версию PowerShell Core параллельно с PowerShell 7.1, установите нужную версию, используя архив двоичных файлов.
Существует несколько способов установки PowerShell в macOS. Выберите для этого один из следующих методов:
- Установка с помощью Homebrew. Homebrew является предпочтительным диспетчером пакетов для macOS.
- Установка PowerShell через Direct Download
- Установка из архивов двоичных файлов.
После установки PowerShell следует установить OpenSSL. OpenSSL требуется для удаленного взаимодействия PowerShell и операций CIM.
Установка последнего стабильного выпуска с помощью Homebrew в macOS 10.13 или более поздней версии
Если команда brew не найдена, нужно установить Homebrew по соответствующим инструкциям.
Теперь можно установить PowerShell:
И наконец, убедитесь, что установка прошла без ошибок.
После выпуска новых версий PowerShell обновите формулы Homebrew и PowerShell:
Приведенные выше команды можно вызвать из узла PowerShell (pwsh), но затем потребуется выйти из оболочки PowerShell и перезапустить ее, чтобы завершить обновление и обновить значения в таблице $PSVersionTable .
Установка последнего предварительного выпуска с помощью Homebrew в macOS 10.13 или более поздней версии
После установки Homebrew можно установить PowerShell. Сначала установите пакет Cask-Versions, который позволит устанавливать альтернативные версии Cask-пакетов.
Теперь можно установить PowerShell:
И наконец, убедитесь, что установка прошла без ошибок.
После выпуска новых версий PowerShell обновите формулы Homebrew и PowerShell:
Команду, указанную выше, можно вызвать на узле PowerShell (pwsh), но для этого необходимо завершить его обновление. Что в свою очередь будет сделано, когда вы выйдете из PowerShell и перезапустите его. Обновите значения, которые отображаются в $PSVersionTable .
Установка PowerShell с помощью метода tap Homebrew также поддерживается для стабильных версий и версий LTS.
Теперь можно проверить установку.
После выпуска новых версий PowerShell просто выполните следующую команду.
Если вы используете метод cask или tap при обновлении до более новой версии PowerShell, используйте тот же метод, который применяли для первоначальной установки PowerShell. При использовании другого метода новый сеанс pwsh будет продолжать использовать старую версию PowerShell.
Если вы решите использовать разные методы, существуют способы исправить проблему с помощью метода Homebrew link.
Установка с помощью прямого скачивания
Для компьютера с macOS пакет PKG powershell-7.1.4-osx-x64.pkg можно загрузить на странице Выпуски.
Дважды щелкните файл и следуйте инструкциям на экране либо установите его из командной строки:
Установите OpenSSL. OpenSSL требуется для удаленного взаимодействия PowerShell и операций CIM.
Установка в качестве глобального средства .NET
Если вы уже установили пакет SDK для .NET Core, установите PowerShell как глобальное средство .NET.
Установщик инструмента dotnet добавляет
/.dotnet/tools в переменную среды PATH . Но в выполняющейся оболочке отсутствует обновленная переменная PATH . Вы можете запустить PowerShell из новой оболочки, введя pwsh .
Установите OpenSSL. OpenSSL требуется для удаленного взаимодействия PowerShell и операций CIM.
Архивы двоичных файлов
Для поддержки расширенных сценариев развертывания на платформе macOS доступны архивы tar.gz двоичных файлов PowerShell. При установке с помощью этого метода необходимо также вручную установить все зависимости.
Установите OpenSSL. OpenSSL требуется для удаленного взаимодействия PowerShell и операций CIM.
Этот метод можно использовать для установки любой версии PowerShell, в том числе последней:
Установка архивов двоичных файлов в macOS
Установка зависимостей
OpenSSL требуется для удаленного взаимодействия PowerShell и операций CIM. При необходимости вы можете установить OpenSSL с помощью MacPorts.
MacPorts и Homebrew могут приводить к проблемам при совместном использовании в одной системе. Однако у Homebrew нет пакета для OpenSSL 1.0. Дополнительные сведения см. в разделе Часто задаваемые вопросы о MacPorts.
Установите средства командной строки Xcode. Средства Xcode требуются для MacPorts.
Установите MacPorts. Инструкции см. в руководстве по установке.
Обновите MacPorts, выполнив команду sudo port selfupdate .
Обновите пакеты MacPorts, выполнив команду sudo port upgrade outdated .
Установите OpenSSL, запустив sudo port install openssl10 .
Укажите ссылки на библиотеки, чтобы сделать их доступными для PowerShell:
Удаление PowerShell
Если вы установили PowerShell с помощью Homebrew, используйте следующую команду для удаления:
Если вы установили PowerShell с помощью прямого скачивания, PowerShell нужно удалить вручную:
Чтобы удалить дополнительные пути PowerShell, ознакомьтесь с разделом Пути этой статьи, и удалите их с помощью команды sudo rm .
Это не требуется в случае установки с помощью Homebrew.
- $PSHOME имеет значение /usr/local/microsoft/powershell/7.1.4/ .
- Профили пользователей будут считаны из
/.config/powershell/profile.ps1 .
/.local/share/powershell/Modules .
Профили учитывают конфигурацию PowerShell для отдельных узлов. Профиль узла по умолчанию находится в Microsoft.PowerShell_profile.ps1 в тех же расположениях.
Так как macOS является развитием BSD, необходимо использовать префикс /usr/local вместо /opt . Таким образом, $PSHOME имеет значение /usr/local/microsoft/powershell/7.1.4/ , а символьная ссылка размещается в /usr/local/bin/pwsh .
Поддержка установки
Корпорация Майкрософт поддерживает методы установки, изложенные в этом документе. В других источниках могут быть доступны другие методы установки. Хотя такие инструменты и методы могут работать, корпорация Майкрософт не поддерживает их.
Источник