diff --git a/build.psm1 b/build.psm1 index a6ee006028..eded9139e2 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1,3 +1,6 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + # On Unix paths is separated by colon # On Windows paths is separated by semicolon $script:TestModulePathSeparator = [System.IO.Path]::PathSeparator @@ -1614,9 +1617,14 @@ function Start-PSBootstrap { # Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn) if ($Package) { try { - # We cannot guess if the user wants to run gem install as root - Start-NativeExecution { gem install fpm -v 1.9.3 } - Start-NativeExecution { gem install ronn -v 0.7.3 } + # We cannot guess if the user wants to run gem install as root on linux and windows, + # but macOs usually requires sudo + $gemsudo = '' + if($Environment.IsMacOS) { + $gemsudo = $sudo + } + Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.10.0")) + Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ronn -v 0.7.3")) } catch { Write-Warning "Installation of fpm and ronn gems failed! Must resolve manually." }