Setting Up a Mac OS Development Environment

Know the Pain Harold ready to setup his development enviornment

Whether you’re new to a Mac, new to development or you just got a new computer and want to start fresh… Here are the steps I go through to setup my development enviornment.

Congrats! I recommend setting it up without restoring from a backup (if you haven’t already). You can read more on why below, but feel free to skip to the installation instructions to get started.

Benefits of starting fresh on Mac OS

I’ve spent six and a half years working for Apple doing external customer support, as a Senior Advisor, and also spent some time on the internal support side. I’m bringing it up because unequivocally the best possible Mac OS cure-all is Erasing and Reinstalling a fresh copy of your Mac’s operating system.

I’d like to briefly explain why it’s worth considering backing up, erasing, and reinstalling a fresh copy of your computer, manually migrating your files, and manually re-configuring your dev environment with the steps I use below.

Over time, who knows how many global npm packages, sql database configurations and or other dependencies you may have installed. Obviously, it’s possible to monitor and update your dev dependencies, but especially if you’re interested in security and performance, I recommend starting fresh every once and a while.

To erase and reinstall a fresh copy of the OS on your Mac, first backup to Time Machine so that you can manually restore from these and recover system configurations later if needed. Then, when you’re ready, click this link and follow Apple’s offical support documentation on erasing and reinstalling from Recovery. These are the same steps you take when you’re ready to sell or give away your mac. If you’re setting it up again, don’t restore from the backup, manually migrate your files, and follow these steps to get your basic development dependencies up and running.

Lets get started

Note: I’m going to be listing setup instructions based on popular development dependencies, feel free to skip dependencies that you don’t plan on using or needing. I’ll continue to update so feel free to check back as your languages or dependencies change.

Install Homebrew

This step on your mac is essential to other dev dependency installations. It’s worth noting that this installation automatically installs XCode command line tools. Run this line of code, here’s where you can verify if it’s the latest, and you’re set:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Git

brew install git

Note that you’ll also need an ssh key tied to your github account for secure data transfering. To do this first run

ssh-keygen

Then you can view your ssh key by running

~/.ssh/id_rsa.pub
Copy & paste to GitHub profile > settings > SSH & GPG Keys, ‘New SSH Key’. Add to profile

After that, login to Github, click on your profie, open Settings then click “SSH & GPG Keys” on the left. Select ‘New SSH Key” and copy paste this key to that field. You can name the key after your computer type or the name of your machine. Next, configure the Git CLI with:

git config --global user.email “you@example.com
git config --global user.name “Your Name”

(Optional) Github Desktop is great incase you ever need to undo a push to your project’s branches.

Encryption & Security Support

brew install gnupg

Download Code Editors

Feel free to install your preferred editor, these are the two I prefer…

VSCode

  • Current download link
  • Open it, select “View” > “Command Pallet” and type “Command Pallet: Add code to terminal”. Now you’ll be able to use the code command in terminal to open directories.
  • Optional: Sync / Import your previous settings (article coming soon)

Thoughts on Terminal

Your mac comes standard with Zsh as your default command line shell in the Terminal application. If you want to give your terminal a bit of a facelift, you can consider iTerm 2 and Oh-My-Zsh styles. If you’re a bash fanatic, there’s a few steps you can follow below to set it as your default I’ll throw out there just incase as well.

A super-powered terminal alternative: https://iterm2.com

How to change the default shell to Bash on Mac OS Catilina: https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/

How to update your version of Bash on a Mac: https://itnext.io/upgrading-bash-on-macos-7138bd1066ba

order to enable a theme, set ZSH_THEME to the name of the theme in your ~/.zshrc, before sourcing Oh My Zsh; for example: ZSH_THEME=xiong-chiamiov-plusis a good one. If you do not want any theme enabled, just set ZSH_THEME to bl: ZSH_THEME="". Themes are listed below on GitHub.

As Node updates more than I update my blog posts, please be sure to verify the latest install commants here. These are the latest as of Feb 2021:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash# This next command loads nvm into ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install nodenvm use nodenvm alias default node

Angular

npm install -g @angular/cli

Vue

npm install -g @vue/cli
# OR
yarn global add @vue/cli

React / React-Native

Personally, I don’t install these globally. Creating a package I run them through nvm instead. A note on react-native, to develop apps simpler you may want to install Xcode (available free on the Mac App Store) and Android Studio

nvm create-react-app#ornvm create-react-native-app

Yarn

brew install yarn

.NET

Please verify the download instructions here. If you want to give Visual Studio for Mac a try, it can help sometimes for .NET development, but imo is almost useless on Mac. If you’re a serious C# fanatic, Rider is probably the one you want.

Ruby Version Manager (RVM)

I’ll update this article frequently, but be sure to check that you’re installing the latest stable release of ruby by checking it here. If you want to see the list of versions that rvm has installed on your old development environment, you can run rvm list.

curl -sSL https://get.rvm.io | bashsource ~/.bash_profile (reloads your terminal configuration file)rvm get stablervm install 2.6.3rvm use 2.6.3 — defaultruby -v to verify

Gems

The bundler gem is going to more or less be required by almost every project, so I’d definitely install that. Nokogiri is a gem to help parse HTML and is useful for scraping websites. I’d recommend that too as a basic system gem.

gem install bundlergem install nokogiri

Fuck

Congratulations, you’ve just unlocked: An actual, essential commandline utility fuck (Requires RVM and Gems). fuck typed into the terminal will correct spelling mistakes and auto-type suggested corrections upstream. Cons: way too fun to type.

Rails

gem install rails

Composer

The easiest way to install Composer is to directly download to your downloads folder from getcomposer.org by clicking the link below, then enter the following commands in the terminal.

https://getcomposer.org/composer.phar?source=post_page---------------------------

php ~/Downloads/composer.phar — version   (shows the version)cp ~/Downloads/composer.phar /usr/local/bin/composer   (copies it)sudo chmod +x /usr/local/bin/composer     (installs it)composer — version       (verifies installed version)

Laravel

composer global require laravel/installer

MySQL

brew install mysqlbrew tap homebrew/servicesbrew services start mysql(Next step is not required if you only run it locally using mysql.server start / mysql.server stop, but generally still recommended)mysqladmin -u root password ‘yourpassword’

SQLite

brew install sqlite

Postgres

brew cask install postgres

MongoDB

brew install mongodb

Redis

brew install redis

Firebase

npm install -g firebase-toolsfirebase loginfirebase list   (verify it's installed)

Heroku

brew tap heroku/brew && brew install herokunpm install -g herokuheroku — version to confirmheroku login

Netlify

npm install netlify-cli -g

Final Thoughts

That’s about it! This obviously isn’t including every framework and language. These are the ones I’ve been coding in the most lately.

Do you have development packages, languages or apps that you prefer which aren’t listed? Leave me a comment below. I’d love to hear your feedback!

Full Stack Software Engineering. Flatiron School. 6 years at Apple. Visual artist & award winning Apple support expert. Here to learn & write about code.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store