Archives For Programming

powershell on macos

July 4, 2017

I wrote in an earlier post about easily installing multiple applications on macOS. One of those applications interestingly enough is Microsoft’s PowerShell. Microsoft has open sourced PowerShell and made it available on GitHub (https://github.com/PowerShell/PowerShell). From GitHub you can either grab the source and build it yourself, download and install a pre-built binary, or both. I chose to just grab the binary and run with it as I have enough projects to keep me occupied as it is. The current PSVersion is 6.0.0-beta, and it’s shown running on macOS 10.12.5.

I start PowerShell for Mac from the ITerm2 command line, and from there I can look about PowerShell all I want. While the shell appears feature complete as far as syntax is concerned, PowerShell for Mac is missing considerable core .Net functionality when compared to the versions that run on Windows. As one small example shows below, Get-PSProvider doesn’t show the provider for the registry, as there is no equivalent (at all) on macOS. While it’s nice to have the same shell running across multiple platforms, as bash does, PowerShell for Mac and Linux isn’t going to be nearly as useful as it is on Windows if you want full Windows functionality on another OS. Any PowerShell scripts that are developed to take heavy advantage of Windows OS functionality are going to fail pretty hard on both the Mac and Linux, just to give you fair warning.

By the way, two comments on PowerShell help:

  1. If you decide to update PowerShell’s help, then run PowerShell as sudo before running Update-Help, or the updates will fail.
  2. The graphical view of help (via -ShowWindow) isn’t implemented and won’t work.

One tool not provided by the PowerShell project is the PowerShell ISE (Integrated Scripting Environment). The ISE is bundled with every copy of Windows these days, and is a powerful way to write and debug PowerShell scripts of any complexity on Windows. For the Mac the next best tool to use is Visual Studio Code with the PowerShell v1.4.1 extension (see below). You get full syntax highlighting and support as well as a split screen with code at the top and a PowerShell prompt at the bottom. The only major feature missing in this setup is the help section that is displayed to the right (by default) in the native ISE.

PowerShell for Mac and Visual Studio Code for Mac are an interesting counterpoint to Windows Subsystem for Linux on Windows 10. For those folk who like to “swim” in the lower regions of coding and operating systems, we’re living in a golden era.

There has been talk for some time about how Apple devices running iOS are contenders for replacing standard Intel architecture computers, such as MacBook Pros. Since I have a number of Apple devices, I thought I’d install Geekbench 4 (version 4.1) and run it across three of my Apple devices. I’ve put the results in a simple table below, with the results in the first three rows.

MBP mid-2015 iPhone 7 Plus iPad Pro 2016
CPU Single-Core 4462 3457 3017
CPU Multi-Core 16005 5872 5082
Compute 38117 12296 14764
Processor Intel Core i7 Apple A10 Fusion Apple A9x
Max Frequency 2.8 GHz 2.34 GHz 2.26 GHz
OS macOS 10.12.5 iOS 10.3.2 iOS 10.3.2

The MBP I own is a 15″ Retina MBP with 16GB of memory and the 2.8GHz quad-core i7. I wasn’t surprised to see the MBP be the leader across the board, particularly in multi-core scoring. The MBP is certainly the brawniest of the three with its Intel processor and eight times the memory over both the iPhone and iPad. Keep in mind that the MBP is the oldest of the three devices.

What I found rather interesting is the GPU-based Compute score. The iOS version of Geekbench uses Metal, the graphical framework that’s a part of iOS. Geekbench on the MBP uses OpenCL and because I’m too cheap to buy a copy, the built-in Iris Pro on the i7 processor was used instead of the beefier¬†AMD Radeon R9 M370X. So even though I’m using the “lesser” graphics processor and “poorer” graphics software framework, the MBP still scored a solid two to three times faster than either iOS device. Of further note is the sizable performance lead of the iPad over the iPhone, even though the iPhone’s CPU is clocked faster and it’s using a more current Apple SoC.

So, am I ready to trade in the MBP for either iOS device? It all depends on the use case.

For general uses involving reading content and typing, I could easily switch to the iPad Pro. I use it with a Logitech keyboard-and-cover in landscape mode, which, when attached to the iPad using the Smart Connector gives me a decent keyboard with back-lit keys. It’s not as efficient and comfortable as the MBP keyboard, but it’s more than serviceable especially over a period of hours. I can do writing and other types of textual creation, as well as fairly sophisticated graphical content creation and photo/video post processing. There are, however, limits to the iPad Pro.

For the ultimate web experience I prefer the MBP and my selection of browsers, which includes Chrome, Firefox, and Vivaldi. I am not a fan of Safari on either iOS or macOS, and I don’t think I ever will be. What makes web browsing on iOS truly annoying is Apple’s insistence of forcing every other browser to use the Apple web engine used by iOS Safari; it is buggy and poorly performant.

When I need to develop software I much prefer the MBP. When I need to do light code editing on the iPad Pro I use Textastic with Working Copy. I have iOS Terminus that allows me to ssh into machines around my home running Linux and macOS (nothing like that for Windows, unfortunately). Under ssh I tend to use vim with extensive vim customizations and colorizations. And I can use scp and git to move things around that need moving. So the iPad Pro makes a pretty decent work platform when I don’t want to fire up the MBP, especially when I need to put it down due to interruptions.

I haven’t even mentioned the iPhone, but it’s decent enough that it can fill in for the iPad when all I can carry with me is just the iPhone. I use a Microsoft Folding Bluetooth keyboard to type on, and I have an SDHC to Lightening card reader for reading JPEG and RAW files produced by my Olympus cameras. The same apps I would use on my iPad to post process work just fine on the iPhone 7 Plus. And when I don’t want to, or can’t have, my Olympus camera, then the iPhone 7 Plus camera is just fine.

Finally, there’s the truly heavy lifting that the MBP is called upon to do. For example, I have a number of Linux virtual machines I power up to perform testing and development in parallel with work on the MBP. I use Xcode to develop iOS applications, as well as Android Studio to develop Android applications. If I want to develop using a full Javascript stack starting with node.js, then the MBP is the only way to go. If I want to develop in Java or Python or Go or Rust, only the MBP allows me to do that.

And the 15″ screen on the MBP is the easiest of all the screens to read, which is important due to my poor eyesight (20/700 and near sighted).

There is no easy answer to the original question, except to say it all depends. As long as I can choose which to use for which task, I will choose all three based on the work at hand that needs to be done.

But I am impressed with what the Apple SoCs can accomplish. While the MBP rules them all, for single core scoring all three devices are fairly close together, compared to multi-core and compute. This bodes well for Apple’s continued evolution of its ARM-based processors, and if I were Intel, I really would be looking over my shoulder at ARM in general and Apple in particular.