Running PowerShell on Mac OS X

As I mentioned in a previous post, I’ve been [trying] to use a Mac for development here at OneCause. Of course, that’s “impossible” without PowerShell…but I ran into a couple of issues right off the bat when trying to use it.

I tend to run with a customized prompt, so the first issue I ran into involves making sure you return something (anything–in my case, I’m just returning a single space).  If you don’t, PowerShell assumes the <code>prompt</code> function failed to do its job and uses its own function anyway.

One of the PowerShell modules I use most is posh-git; although there are many things I’d like to improve about it, it continues to grow and I can’t imagine living without it.  When first using PowerShell on Mac OS X, it looked like the <code>prompt</code> function was being called multiple times and when I’d start typing anything the cursor would needlessly jump around.  I have a custom prompt.  Originally I thought it was related to a PSReadLine issue, before moving on to troubleshooting by removing various lines one at a time.  Ultimately it was the PSReadLine issue, which I was unable to resolve in PowerShell itself–any attempts to update or install that module were useless, sometimes resulting in multiple copies of the module being installed.  I was able to clear the directory PSReadLine was in (found using <code>(Get-Module PSReadLine).Path</code> and replacing the contents with that of a Beta1 release of PSReadLine 2.0 I downloaded.  And now my console prompt is back to normal:

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *