PowerShell/docs/building/osx.md
Andrew Schwartzmeyer ea5d5c3d05 Switch to netcoreapp1.0
Instead of using `dotnet publish`, we can use `dotnet build` and the new
`netcoreapp1.0` framework with a new dependency on
`Microsoft.NETCore.App` to generate output that does not include the
runtime, but can be run anywhere (given the installation of the
runtime).

While we cannot yet adopt a dependency on the shared host until .NET
Core RTM, we are forced to switch to this system anyway because the
latest RC3 packages and CLI do not support `netstandardapp1.5`. See
dotnet/cli#2482.

Thus we're in an in-between state where we have to use `netcoreapp1.0`,
but cannot use `"Microsoft.NETCore.App": { "type": "platform" }` to
utilize the shared host, as we need to continue to ship our host.
Without specifying "platform", we retain the status quo with respect to
build steps and outputs.

Additionally, there is no longer a good reason to use the RC3 packages,
and it has been advised we switch to RC2 since the
`Microsoft.NETCore.App` is only available for RC2. We must update
packages because our current version can no longer be debugged.
2016-04-25 14:01:44 -07:00

2 KiB

Build PowerShell on OS X

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

.NET Core (and by transitivity, us) only supports OS X 10.11, per CoreFX issue #7731.

Environment

You will want Homebrew, the missing package manager for OS X. Once installed, follow the same instructions to download and install a self-hosted copy of PowerShell on your OS X machine, and use Start-PSBootstrap to install the dependencies.

The Start-PSBootstrap function does the following:

  • Uses brew to install CMake, OpenSSL, and GNU WGet
  • Downloads and installs the latest .NET CLI package
  • Adds /usr/local/share/dotnet to the process path

Please heed that last step. You may want to add the .NET CLI tool location to your path more permanently by adding it to your shell's profile.

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 your shell's profile to fix it permanently.

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

Build using our module

Instead of installing the Ubuntu package of PowerShell, download the pkg from our GitHub releases page using your browser, complete the wizard, start a powershell session, and use Start-PSBuild from the module.

The output directory will be slightly different because your runtime identifier is different. PowerShell will be at ./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netcoreapp1.0/osx.10.11-x64/powershell, or osx.10.10 depending on your operating system version. Note that configration is still Linux because it would be silly to make yet another separate configuration when it's used soley to work-around a CLI issue.