Powershell: PS Core on Mac updating on launch and setting an alias for brew cask based installs...
You can now install powershell core via homebrew on a Mac. One thing I noticed is that it doesn't, which the pkg installers do, set an alias to launch powershell in the terminal. Instead it installs an "app" in your applications directory to launch powershell. Two things I wanted to accomplish:
- Set an alias to launch powershell in terminal
- Update powershell on launch.
Easiest way to go about this is simply to insert some alias into my .bash_profile. Like so:
- Launch Terminal
- nano ~/.bash_profile
- or vi if that suits your fancy.
- alias powershellupdate="brew update; brew cask reinstall powershell; pwsh"
- alias powershell="pwsh"
- Exit [Ctrl+X] and Y to save.
- source .bash_profile
- This is to refresh your current bash session w/ your newly edited profile.
Once done, I can now type either "powershellupdate" or "powershell" in terminal. I did this approach for simplicity so I can quickly launch powershell if I don't need it to be updated or don't happen to have internet connectivity at time of launch. Further down the line, I think I'm going to try and figure out available version prior to doing a reinstall.