How To Install Powershell 7 On M1 Macos

Hey there, Mac friend! Fancy leveling up your terminal game? Yeah, I thought so. PowerShell 7 on your M1 Mac is where it's at. Trust me, it's way cooler than it sounds. Think of it as giving your command line a serious power boost! Let's get you set up, shall we? Don't worry, it's easier than ordering a latte. Probably.
First Things First: Homebrew Time!
Alright, before we dive in, gotta make sure you have Homebrew installed. What's Homebrew, you ask? Only the coolest package manager for macOS. Basically, it helps you install all sorts of awesome stuff. Think of it as the App Store, but for command-line tools. And way less cluttered. If you haven't already got it, head over to brew.sh and follow the instructions. It's a one-liner copy-paste into your terminal. Can't be simpler than that, right?
Important Note: You'll probably need to open your terminal using Rosetta if you're on an M1 Mac (or later). Why? Because Homebrew sometimes needs a little help running things the "old" way. To do this, find the Terminal app in Finder, right-click, select "Get Info," and then check the box that says "Open using Rosetta." Easy peasy!
Must Read
Brew Install PowerShell: The Magic Words
Okay, Homebrew is ready to rock? Sweet! Now comes the real magic. Open your terminal (the one you opened with Rosetta, remember?) and type this bad boy in:
brew install powershell/tap/powershell

Hit enter. And then… wait. Okay, it might take a few minutes. Go grab a coffee, or maybe check your Twitter feed. Don't stare at the screen, unless you really enjoy watching progress bars. (No judgement here, if you do.)
Pro Tip: If you see any errors during the installation, don't panic! Google is your friend. Seriously, just copy and paste the error message into Google. Someone else has probably run into the same problem, and there's usually a solution lurking on Stack Overflow. The internet is a magical place. Mostly.

Launching PowerShell: Let the Fun Begin!
Installation complete? Congrats! Now, to actually use PowerShell, just type pwsh in your terminal and hit enter. BOOM! You should see a PowerShell prompt. It might look a little different than your usual bash or zsh prompt, but don't be scared. Embrace the difference!
Fun Fact: "pwsh" is short for "PowerShell." Clever, right? Who needs long commands when you can be concise and cryptic?
Making PowerShell Your Default (Optional, but Recommended!)
Okay, using pwsh every time you want to use PowerShell can get a little tedious, right? So, let's make it your default shell! (Completely optional, of course. But why wouldn't you?).

First, check the path to your PowerShell executable. Type which pwsh in your terminal. It'll probably be something like /opt/homebrew/bin/pwsh.
Next, add PowerShell to the list of allowed shells. Open the /etc/shells file with sudo nano /etc/shells (you'll need your password). Add the path you found above to the end of the file. Save the file (Ctrl+O) and exit (Ctrl+X).

Finally, change your default shell with chsh -s $(which pwsh). You'll need to enter your password again. And that's it! Restart your terminal, and you should be greeted with PowerShell goodness by default.
Troubleshooting: When Things Go Wrong (And They Sometimes Do)
Still having trouble? Don't sweat it. Here are a few things to check:
- Rosetta: Double-check that you're opening your terminal using Rosetta. This is crucial for some M1 Mac setups.
- Homebrew Updates: Make sure Homebrew is up to date. Run
brew updateandbrew upgrade. - Permissions: Sometimes, file permissions can get messed up. Try running
sudo chown -R $(whoami) $(brew --prefix)/*. This might help. - Google: Seriously, Google it. Someone else has probably had the same issue.
Final Thoughts: You've done it! You're now rocking PowerShell 7 on your M1 Mac. Go forth and automate all the things! Just don't blame me if you accidentally delete your entire hard drive. (Okay, probably won't happen. Probably.) Happy scripting!
