PowerShell学习笔记——PSOnMacOS-创新互联

✪ PowerShell 学习笔记——PS On MacOS

创新互联坚持“要么做到,要么别承诺”的工作理念,服务领域包括:网站设计制作、网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的千山网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!
I remember that there is a command line tool on Mac OS X using for connecting to Microsoft Azure.  But now, Microsoft is developing MacOS version PowerShell – PowerShell for MacOS v6.0 alpha.  Let’s see it.

1. Download the pkg setup file

You can visit Github website and find the PowerShell repo here: https://github.com/PowerShell/PowerShell, then scroll down to “Get PowerShell” section.  There is a table, find “macos 10.11” line and click “pkg” link, then download will begin.

PowerShell 学习笔记——PS On MacOS

PowerShell 学习笔记——PS On MacOS

PowerShell 学习笔记——PS On MacOS

After finishing your download, find the file in your Download folder and double click it to begin installation.

PowerShell 学习笔记——PS On MacOS

PowerShell 学习笔记——PS On MacOS

If you prefer command line tool to setup PowerShell, it’s OK, here it is:

sudo installer -pkg powershell-6.0.0-alpha.16.pkg -target /

Open a terminal window, copy and paste above command, then press Enter key to run.  Microsoft provides a installation instruction here: https://github.com/PowerShell/PowerShell/blob/master/docs/installation/linux.md#macos-1011, read it carefully.

2. OpenSSL

To follow the instruction, you also need to setup OpenSSL because most networking functions do require OpenSSL to work properly.  On the instruction page, scroll down to “OpenSSL” section, click “their instructions” link, follow the instructions to finish installing Homebrew.

PowerShell 学习笔记——PS On MacOS

Now you must go back to the macos installation instruction page and run the commands list on the page.

brew install openssl
brew install curl --with-openssl

Then for security, you need to patch .NET Core’s cryptography libraries:

find ~/.nuget -name System.Security.Cryptography.Native.dylib | xargs sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib
find ~/.nuget -name System.Net.Http.Native.dylib | xargs sudo install_name_tool -change /usr/lib/libcurl.4.dylib /usr/local/opt/curl/lib/libcurl.4.dylib

3. Try PowerShell Commands in MacOS Terminal

Now you can open a terminal to try this alpha version of PowerShell by typing “powershell” in the terminal window and pressing Enter key, you will enter PS enviroment.

PowerShell 学习笔记——PS On MacOS

Let’s try some cmdlets.

PowerShell 学习笔记——PS On MacOSPowerShell 学习笔记——PS On MacOS

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站栏目:PowerShell学习笔记——PSOnMacOS-创新互联
文章网址:http://myzitong.com/article/ddhocj.html