How to set up a beautiful Powershell Core terminal on Mac OS

I just recently had the opportunity to sit with Aaron Nelson and go through some really cool Powershell features, and I’m certainly going to spend time getting to know Powershell a lot better. If you didn’t know, Powershell isn’t exclusive to Windows anymore – you can actually run a basic set of Powershell features, called Powershell Core, on Mac OS and Linux as well.

But there’s a problem.

By default, running the “pwsh” command just starts Powershell Core in a regular terminal window. The first thing you’ll notice is that this doesn’t really play well if you’re using a white background, as the output is often light grey, yellow or even white.

So wouldn’t it be cool if we could launch our Powershell Core in the stylish blue world of bliss that Windows users have become so accustomed to?

Setting up a color profile

You probably already know that you can customize the Mac Terminal to death, and you may even have noticed that you can create different profiles for different purposes:

What you can do is, you can create a separate profile for your Powershell Core stuff, customize all those colors, fonts, and what-not. But here’s where it gets funkier:

You can set a custom command to start when you open a terminal window with this profile: enter pwsh in the “Run command” field at the top, and now, every time you open a window with this profile, it starts Powershell Core automatically, saving you all of five keystrokes.

The “Run inside shell” checkbox needs to be enabled!

In fact, you may even want to put “pwsh; exit” (without the quotes) in the “Run command” field – this will terminate the bash shell automatically when the pwsh process ends, so typing “exit” in Powershell will close the window.

Another slight annoyance is that when you want to close the window, technically the “pwsh” process is still running (unless you type “exit”), so you’ll get a friendly confirmation dialog that you’ll have to deal with:

To make this window go away, and save you another five keystrokes, look at the bottom of the “Shell” tab of the “Preferences” window, in the “Ask when closing” section. If you add “pwsh” to that list of applications, the terminal won’t ask you for confirmation if you want to close the window.

Obviously, that warning is there for a reason, so it’s really your call if you want to do this.

The result

Now, when you open Terminal, you can select “New Window” -> “Powershell” from the “Shell” menu…

… and voilà:

9 thoughts on “How to set up a beautiful Powershell Core terminal on Mac OS

  1. Nice! The startup command can be optimised:
    – Run command: `/usr/local/bin/pwsh`
    – Uncheck “Run inside shell”,
    – Exclude from “Ask before closing”: `-pwsh`

    Now it doesn’t load the default shell first.

  2. Pingback: Adopting PowerShell |

  3. Does PowerShell on the Mac use the same DOS-based dir command? I’m really frustrated by the poor implementation of find on the mac, and would install PowerShell just to get a dos-style “dir *.zip /s/b”

    • “dir” in Powershell is just an alias for Get-ChildItems.
      You could use “Get-ChildItem -Recurse *.zip” to get the equivalent of dir /b/s *.zip, but I guess you’d have to add some magic to get the full paths.

  4. I wonder how anyone could come up with a tools which has a hardcoded colorschem. Well it’s Microsoft, and one should not expect too much.

  5. It would be awesome to know the RGB colors you chose for the Terminal session. Great post.

  6. I want a white background with black text — I’m not sure how to get that without the funky grey mess.

Let me hear your thoughts!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.