PowerShell/docs/building/macos.md
Ilya 84344cbb32 Update PowerShell to build with .NET Core SDK 2.1.300-rc1-008662 (#6718)
* Build Update
- Change `TargetFramework` to `netcoreapp2.1` and removed unnecessary `RuntimeFrameworkVersion` from `PowerShell.Common.props`
- Update dotnet SDK to 2.1.300-rc1-008662
- Update `TypeGen` target in `Build.psm1` to work with 2.1
- Rename macOS runtime to `osx-x64` as the old build logic expects 10.12 and breaks running on 10.13 system.
- Remove `PackageReference` to `System.Memory` as it's part of dotnetcore 2.1
- Update search for `crossgen` executable to find the matching version

* Test Update
- Update test tools `WebListener` to latest `asp.net core`
- Marked `AuthHeader Redirect` tests as `Pending` due to change in CoreFX
2018-05-02 16:58:39 -07:00

1.5 KiB

Build PowerShell on macOS

This guide supplements the Linux instructions, as building on macOS is almost identical.

.NET Core 2.0 (and by transitivity, us) only supports macOS 10.12+.

Environment

You will want Homebrew, the missing package manager for macOS. Once installed, follow the same instructions to download and install a self-hosted copy of PowerShell on your macOS machine. From pwsh.exe, run Import-Module ./build.psm1 and use Start-PSBootstrap to install the dependencies.

The Start-PSBootstrap function does the following:

  • Uses brew to install CMake, OpenSSL, and GNU WGet
  • Uninstalls any prior versions of .NET CLI
  • Downloads and installs a preview version of .NET Core SDK 2.0 to ~/.dotnet

If you want to use dotnet outside of Start-PSBuild, add ~/.dotnet to your PATH environment variable.

error: Too many open files

Due to a bug in NuGet, the dotnet restore command will fail without the limit increased. Run ulimit -n 2048 to fix this in your session; add it to your shell's profile to fix it permanently.

We cannot do this for you in the build module due to #847.

Build using our module

Start a PowerShell session by running pwsh, and then use Start-PSBuild from the module.

After building, PowerShell will be at ./src/powershell-unix/bin/Linux/netcoreapp2.0/osx-x64/publish/powershell. Note that configuration is still Linux.