1. Powershell Ide For Mac

PowerShell Core is a cross-platform (Windows, Linux, and macOS) automation and configuration tool/framework that works well with your existing tools and is optimized for dealing with structured data (e.g. JSON, CSV, XML, etc.), REST APIs, and object models.

As a mobile developer 90% of the time I work on a mac. Visual Studio for Mac is an awesome tool to create Xamarin mobile apps. More than not mobile apps are using services. You can use .NET Core to create APIs but deploying them isn't so easy on a mac. Sure you can use the Azure CLI, but if you are working with mixed teams Powershell seems to be king to deploy towards Azure.

About a year ago Microsoft made Powershell available for MacOs. But that doesn't mean you can use all of the Modules that are available. Until a few days ago you couldn't use AzureRM. Now that the AzureRM.NetCore is no longer in preview, it's time to explain how you can use the power of Powershell and AzureRM on your mac.

Installing Powershell

As I couldn't get the AzureRM modules working on an older version you need to make sure you run the latest version of Powershell for Mac.
You can download a .pkg package from https://github.com/PowerShell/PowerShell.
Installing is as simple as any other package. Just follow the wizard.

After installing the package you can verify the version of Powershell by opening a terminal window and start Powershell.

The version I have is v6.0.0-beta4. I couldn't make AzureRM work with version v6.0.0-beta3 so make sure you have at least version v6.0.0-beta4.

Installing AzureRM modules

Before installing modules you'll need to know in which directory you want to store your modules.
Open a Powershell and verify the path where you can store your modules

Powershell For Mac

My path looks like:

I will store my modules in:

To install the AzureRM modules you'll need to open up a terminal and login as a root user. The instructions come from: https://www.powershellgallery.com/packages/AzureRM.Netcore/0.9.1

The path provided in the latest command corresponds with the path you found via $env:PSModulePath

Using the AzureRM modules

You can close the admin/root session and start a session as normal user.

Verify that the AzureRM modules are available

If you try to execute the Login-AzureRmAccount login command to login on Azure and start executing your scripts.

What if the AzureRM modules are not available?

When starting a Powershell session, not all modules are loaded to save memory. Depending on how you installed or stored the modules they won't be available by default.

So if the Login-AwureRmAccount is not available for you, you can auto load the AzureRm modules when starting a new Powershell session. You can do that by changing your profile.

Search for your profile:

My profile is located on:

If it doesn't exist you can simply create it.

You can simply import a module by adding 'Import-Module MyModuleName' in the file. Because AzureRM has multiple modules you can add them in one command

Authenticate to Azure via Powershell

Now you can authenticate via Powershell so can start executing the powershell scripts in your Xamarin solution.

Now open up a browser and go to https://aka.ms/devicelogin, provide the code that you got in your powershell session and you're good to go!

Conclusion

Microsoft made powershell and the AzureRM Modules available on MacOS. It will allow us to automate our backend deploys for our Xamarin mobile apps without switching to Windows.

Details
Written by Ferdinand Rios
Last Updated: 06 September 2016
Created: 19 August 2016
Hits: 10428

Now that PowerShell is available on the Mac, we thought it would be useful to show how easy it is to setup a Mac terminal session that automatically opens into PowerShell. Figure 1 shows what we mean.

Figure 1 – PowerShell Terminal Session

First you need to download the PowerShell macOS package from here (look for the Get PowerShell section in the README.md) and install it using the directions found here . Once PowerShell is installed and running on your system, follow the instructions below to set up your PowerShell terminal

Here are the steps to follow:

  1. Open Terminal on the Mac in whatever fashion you usually use
  2. In the Terminal menu, select Preferences…
  3. Select Profiles in the Preferences window toolbar
  4. Select a Profile in the left list
  5. Select the Gear icon at the bottom of the list
  6. Select Duplicate Profile from the drop down
  7. Rename the new profile to PowerShell
  8. In the Text tab on the right do the following:
    Figure 2 – Text Preferences
    1. Click on Color & Effects and select a Dark Blue color from the color wheel
    2. Change the font to Menlo Regular 24 (or whatever works for you)
    3. Check all the attributes in the Text section
    4. Click on _Underline in the cursor section
  9. Click the Window Tab
    Figure 3 – Window preferences
    1. Set the title to whatever you want. We like Windows PowerShell
    2. Check or uncheck the other items you want or don’t want to see in the title bar
  10. Select the Tab tab
    Figure 4 – Tab preferences
    1. check the options you want to see when you have PowerShell tabs
  11. Click the Shell tab
    Figure 5 – Shell preferences
    1. Check Run Command and type in powershell (lowercase)
    2. Click on Run inside shell
    3. Click Never in the Ask before closing section

You now have a PowerShell profile. To open a terminal window right to PowerShell, select the Shell Menu from the Terminal menu bar. Then select New Window / PowerShell. Viola! Up comes your PowerShell terminal window.

If you ONLY want to use PowerShell as your terminal window, you can set your startup preference to your PowerShell profile:

Figure 6 – New window with profile

or set PowerShell as your default profile.

Figure 7 – Set default profile

There you have it! Happy PowerShelling on your Mac!

Powershell

UPDATE:

Want PowerShell on your dock for immediate access? In the Terminal Preferences pane, select the PowerShell profile you created. At the bottom of the list click on the gear icon and select Export. This will create a .terminal file. Dragged the terminal file to the right side of your dock (right of the dividing line where your folders and documents live). You now have a Dock icon that immediately starts a PowerShell Terminal!

Figure 8 – Create a .terminal file
Figure 9 – PowerShell on the Dock

Powershell Ide For Mac

If you have questions about our products, please post in our support forum.
For licensed customers, use the forum associated with your product in our Product Support Forums for Registered Customers.
For users of trial versions, please post in our Former and Future Customers - Questions forum.
Coments are closed
Scroll to top