DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,864 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cecelia Martinez
Cecelia Martinez

Posted on

Mac Web Developer Setup: Terminal, zsh, Git, Node, VS Code, Homebrew, and GitHub CLI

I’ve had to set up a Macbook for development three times this year, and hit road blocks each time. This time, I decided to write down and record the process based on what I’ve learned from previous attempts.

My machine specs: Macbook Air, M1, Monterey 12.6

Here is my checklist, complete with links to documentation, run commands, and notes for potential issues you may encounter. It’s important to complete the steps in order, as there are dependencies installed in each step required for later installations.

Note

These are based on my experience with trial and error setting up a machine. If you have recommendations for improving this process, please comment!

Video walkthrough of the process:

1. iTerm2

Terminal alternative for Mac, recommended to me and I’ve used it for years.

Installation

2. Xcode Command Line Tools (CLT)

This should be installed already via Step 1, but it's important to validate the entire package was installed.

Validation

  • validate full package installed via iTerm2 with xcode-select -p
  • Should see /Library/Developer/CommandLineTools
  • Run ls /Library/Developer/CommandLineTools/usr/bin/git
  • Should see /Library/Developer/CommandLineTools/usr/bin/git
  • Source: https://mac.install.guide/commandlinetools/2.html

3. Git

Installs automatically with Xcode CLT, but also important to validate installation was successful.

Validation

4. ZSH

ZSH is the shell used in your terminal. As of MacOS 10.15, ZSH is the default over Bash. If you are using Bash or have Bash installed, your setup will be different.

Configuration

5. NVM

NVM is recommended to navigate between versions and to avoid permission issues when installing Node directly on Mac.

Installation

  • Run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh
  • Restart terminal instance
  • Validate nvm installation with nvm -v
  • nvm install --lts
    • This installs the latest long-term support version of Node, recommended for most users (https://nodejs.org/en/)
    • Can also specify a certain version or nvm install node for latest version
    • first version installed becomes default, to update default in the future run nvm alias default <VERSION>
  • validate Node installation with node -v
  • Source: https://github.com/nvm-sh/nvm#install--update-script

Troubleshooting Notes

  • Source: https://github.com/nvm-sh/nvm#troubleshooting-on-macos
  • Since macOS 10.15, the default shell isΒ zshΒ and nvm will look forΒ .zshrcΒ to update, none is installed by default. Create one withΒ touch ~/.zshrcΒ and run the install script again (already handled with step 4)
  • Homebrew installation is not supported. If you have issues with homebrew-installedΒ nvm, pleaseΒ brew uninstallΒ it, and install it using the instructions below, before filing an issue.
  • For Macs with the M1 chip, node started providingΒ arm64 arch darwin packages since v16.0.0. For earlier versions, there were onlyΒ darwin_x64 packages available but noΒ darwin_arm64. If you are facing issues installing node usingΒ nvm, you may want to update to v16 or later.
  • You might need to restart your terminal instance or runΒ . ~/.nvm/nvm.sh. Restarting your terminal/opening a new tab/window, or running the source command will load the command and the new configuration.

6. VSCode

A popular free code editor/IDE from Microsoft that provides a built-in terminal and various plugins for development.

Installation

7. Homebrew

Recommended for GitHub CLI installation, and can be used for managing other packages installed globally on your Mac.

Installation

  • Xcode CLT required for installation (already handled with steps 1+2)
  • Run /bin/bash -c "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh](https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh))" and follow prompts to install
  • May receive warning that brew is not in PATH with next steps. Run these two commands in your terminal to add Homebrew to your PATH:
    • echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/cecelia/.zprofile
    • eval "$(/opt/homebrew/bin/brew shellenv)"
  • Validate install with brew -v
  • Source: https://brew.sh/

8. GitHub CLI

Highly recommended for interacting with GitHub from the terminal. You can skip if you prefer to use GitHub Desktop or interact with GitHub via Git and HTTPS/SSH, you can skip this step.

Installation

  • brew install gh
  • Run gh auth login
  • Select GitHub.com or GitHub Enterprise
  • Select HTTPS or SSH
  • Set title for SSH key
  • Select Login via web browser, this will launch GitHub in your browser
  • Create key if needed and authenticate in web browser
  • Terminal output will confirm you are authenticated
  • Validate with gh auth status
  • Source: https://cli.github.com/manual/

Now you are all set up and ready to start developing! Check out the documentation for GitHub CLI for more information on how to set up projects, check out pull requests, and more.

Top comments (3)

Collapse
 
nerajno profile image
Nerando Johnson

@ceceliacreates .... have you considered ever making a dotfile ?

Collapse
 
ceceliacreates profile image
Cecelia Martinez Author

You know, at this point I really should πŸ˜…

Collapse
 
sso profile image
Sall

Nice post, I liked the idea. If you would like to collaborate on similar topics and matterialize some ideas, you can find us here:
πŸͺ„ wiki.zshell.dev πŸ§™β€β€β™€οΈ

About Real-time

Join DEV and MongoDB to build a front-end application using MongoDB Atlas. Change streams to display live updates as your database changes for your entry in the DEV x MongoDB Atlas Hackathon 2022.

β†’ Join the Hackathon