Archive for the 'Mac OS X' Category

Fixing “Debug adapter process has terminated unexpectedly” error in VSCode for PowerShell

VSCode is the primary tool that Microsoft provides on Linux and Mac OS to edit and debug PowerShell scripts. Yet, on MacOS, with default installation, you are likely to get the “Debug adapter process has terminated unexpectedly” when you try running your scripts.

However, to fix this issue you simply need to install OpenSSL on your Mac running VSCode as described here.

Once this is done, simply:

  1. Click File / Open and open the folder containing the PowerShell script,
  2. Click the script that you want to edit in the left-hand pane,
  3. Set breakpoints where you want them by clicking on the margin by the corresponding script line,
  4. Press F5 or click the run button in the editor:

Debugging PowerShell scripts on Mac OS X in VSCode

Happy scripting!

Enabling Intellisense for PowerShell cmdlets in VSCode on Mac OS X

VSCode is the primary way to edit and debug PowerShell scripts on Mac OS and Linux. If you do not have it yet, follow these instructions on GitHub on installing VSCode on Mac OS/Linux/Windows and adding its PowerShell extension.

Once you are done with that, you can create a new or open an existing PS1 file, however, you might still get “No suggestions” error when you try to get intellisense for cmdlets:

VSCode on Mac no suggestions

This is because this functionality actually requires OpenSSL. Here’s how you add it to your system:

Install Homebrew

Homebrew is Mac’s most popular package manager. To install it:

  1. Open a Terminal window,
  2. Install Mac OS command-line developer tools (xcode) by pasting the following command and pressing Enter:
    xcode-select --install

    Install Mac OS command-line developer tools xcode
  3. Install Homebrew package manager by pasting the following command:
    ruby -e "$(curl -fsSL"
    Installing Homebrew Mac OS package manager
  4. Double-check that the installation is successful by running

    brew doctor

    System ready to brew

Install OpenSSL

Now install OpenSSL on Mac OS by simply pasting the following command to the Terminal window:

brew install openssl

 Install openssl on Mac OS X with homebrew

Verify PowerShell cmdlet intellisense in VSCode

  1. Start VSCode,
  2. Open a ps1 file or save the file that you have as .ps1,
  3. Verify that PowerShell is selected as the language mode at the bottom right of the VSCode window:PowerShell language mode in VSCode
  4. Type Get- and you will see the intellisense window popping up with the list of available Get- cmdlets:VSCode with intellisense for PowerShell cmdlets

Run PowerShell on Mac OS X

As you have probably heard by now, Microsoft has just open-sourced PowerShell and made it available for Linux and Mac OS X. In this blog post, I will take you through the steps to download, install and run PowerShell on a Mac.

Download and Install PowerShell for Mac OX

  1. Go to PowerShell github project:
  2. Scroll down to the Get PowerShell section and download .pkg:

Download OS X pkg file for PowerShell

3. Locate the newly downloaded file in Downloads, right-click it and click Open:

Install PowerShell pkg on Mac OS X

4. You will be warned that this is a file from the Internet and then prompted for your local administrative password, then go through the installation wizard.

Run PowerShell on Mac OS X

PowerShell is a command-prompt in your terminal window, so to start it:

  1. Start the Terminal application,
  2. Now you can simply type powershell as a command and this will start the PowerShell engine and move you from the bash prompt ($) to the PowerShell prompt (PS):
    Starting PowerShell prompt on Mac OS X in bash Terminal

  3. That is it! You can now type a PowerShell command and see the output. For example, here’s Get-Process:
    Get-Process powershell command on Mac OS X

If you are new to PowerShell, see the Learning PowerShell page on GitHub.

My Recent Tweets


The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

February 2017
« Aug    

%d bloggers like this: