Skip to content

Instantly share code, notes, and snippets.

@qlawmarq
Last active November 30, 2022 02:49
Show Gist options
  • Save qlawmarq/53013f9fb25e515f8beb26ed65852a79 to your computer and use it in GitHub Desktop.
Save qlawmarq/53013f9fb25e515f8beb26ed65852a79 to your computer and use it in GitHub Desktop.
How to setup Mac PC for developer

How to setup Mac PC for developer

Install Homebrew

Homebrew installs tools you need that Apple didn’t.

https://brew.sh

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

If you are using Apple silicon Mac, then you may need to add this script eval "$(/opt/homebrew/bin/brew shellenv)" to your .zshrc or .zprofile.
Follow the official instructions first.

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile

After the installation is complete, install tools as you wish, like so:

brew install git
brew install --cask google-chrome 
brew install --cask visual-studio-code
brew install --cask docker

The following installation can be performed with the above command.

Also, you can search for whatever you need from here: https://brew.sh/

Setup Git

Set up your name and email address to global cofig:

git config --global user.name "John Smith"
git config --global user.email johnsmith@example.com

If you don't have git installed, execute the following:

brew install git

Create SSH key (Optional)

You may need an SSH key to access some of development environment.

ssh-keygen -t ed25519 -C "your_email@example.com"

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

Install anyenv

With anyenv, you can easily install any programming language environment.

brew install anyenv

After the installation is complete, add this init script eval "$(anyenv init -)" to .zshrc.

echo 'eval "$(anyenv init -)"' >> ~/.zshrc

After that, you need to initialize definition.

anyenv install --init

Now you can setup multiple languages in anyenv.

In next section, you will learn how to install Python and Node.js, but you can also use anyenv to install other languages.

Python, Node.js, Go, Ruby, etc.

https://github.com/anyenv/anyenv-install

anyenv install rbenv
anyenv install pyenv
anyenv install nodenv
anyenv install goenv

Install Python using anyenv/pyenv

Please skip if you don't need Python.

anyenv install pyenv
exec $SHELL -l

If you get this error, please check anyenv installation flow again. anyenv require initialization of definition.

anyenv-install: definition not found: pyenv

When the installation is complete, now you can check available version of Python.

pyenv install --list

Then install specific version of Node.js, and make it available globally.

pyenv install 3.9.10
pyenv global 3.9.10
exec $SHELL -l

Then, check current Python version.

python -V            
Python 3.9.10

Install Anaconda (optional).

pyenv install Anaconda3-2022.10
pyenv global Anaconda3-2022.10

For more info: https://github.com/pyenv/pyenv

Install Node.js using anyenv/nodenv

Please skip if you don't need Node.js.

anyenv install nodenv
exec $SHELL -l

If you get this error, please check anyenv installation flow again. anyenv require initialization of definition.

anyenv-install: definition not found: nodenv

When the installation is complete, now you can check available version of Node.js.

nodenv install -l

Then install specific version of Node.js, and make it available globally.

nodenv install 16.14.0
nodenv global 16.14.0

Then, check current Node.js version.

node -v
v16.14.0

For more info: https://github.com/ekalinin/nodeenv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment