PowerShell As Admin Mac OS Shortcut

This is just a quick article to show you how to create a desktop shortcut to always run PowerShell as admin on Mac OS.

  1. Create a text file with the following contents using TextEdit (in plain text):

    #!/bin/bash
    sudo pwsh
    
  2. Save the file in plain text on your desktop as anything you like, for this example I’ll call it PowerShellAdminShortcut.txt

  3. You now need to remove the “.txt” file extension from the file if you weren’t able to save it without it already, if so skip this step and related sub-steps. To do this, follow the below:

    1. Open Finder
    2. Open Finders' preferences
    3. Select the Advanced tab and the check the box “Show all filename extensions” Enable Show File Extensions - Mac OS
  4. Now rename the file you created at the beginning of this process and remove the file extension “.txt” Remove File Extensions - Mac OS

  5. Now open the Terminal app and run the following commands (please replace the file path with where you have placed your file):

    1cd /Users/jacktracey/Desktop
    2chmod 744 PowerShellAdminShortcut
    

    chmod on Mac OS

  6. You should now have a shortcut on your desktop that launches PowerShell as admin (sudo) on your Mac PowerShell As Admin Mac OS Shortcut

Hope this helps some of you out there as now all you need to do is double click this shortcut and enter your user account password and job done!