Rushing Labs

What's my shell again?

So...I just made the switch to an M1 MacBook Air. Like many others. And it's been about 6 years since I last personally used a Mac. So, I started my reintroduction to Mac OS and getting acquainted with my shiny new laptop.

However, I've never needed to configure any terminal application. The default functionality has always been enough to get my work done. Trying to use Node.js on M1--and running into a need for zsh--has changed that for me.

So, I'm hoping to share a little about that experience here.

Bombarded: Drowning in Tools§

As I said, it's been a while since my last foray with Mac OS, so I figured a quick Google search was in order before installing random tools and possibly mucking up my environment.

I was wrong.

Immediately, I ran into dozens of recommendations for varying combinations of: homebrew, iTerm2, zsh (as opposed to bash?), OhMyZsh, and of course nvm (for managing npm).

Cue flashbacks to the explosion of JS tools in 2015 web development.

Shortest path to running npm?§

  • Answer: which shell am I running?
  • zsh (default) -> may as well install OhMyZsh then
  • reload terminal, install nvm

What's my shell, again?§

(yes, a Blink182 reference)


Of course, StackOverflow has the answer. Short answer is, zsh is likely your default. To verify, you can check from Terminal's menubar by Terminal -> Preferences -> General, or running the following:

# for currently running
ps -o comm= $$
# for default
echo $SHELL

False Start, need a profile§

After determining my shell, I then attempted to install nvm (to better manage npm).

curl -o- | bash

However, this is where I received an error stating I didn't have a shell profile available.

[ NOTE: Insert pic of error message showing missing profile configs ]

  • ~/.bashrc
  • ~/.bash_profile
  • ~/.zshrc
  • ~/.profile


Oh My Zsh§

So, at this point I've determined I'm using zsh and tools are telling me I need a profile. I may as well start using Oh My Zsh since I need a profile (~/.zshrc) and it's built for managing exactly that.

To install "Oh My Zsh":

sh -c "$(curl -fsSL"

To learn more:

Works Now§

Recap; I'm using zsh, install Oh My Zsh, and restarted the terminal now. So any PATH variables changes have been loaded into the current session.

Let's install nvm again, and it works this time!

curl -o- | bash

Then we can install npm. Just note, this command will take a few minutes to run. From what I've read elsewhere nvm is compiling npm from source.

nvm install v15