HomeRolesContact
Application Migration
πŸ‘¨β€πŸ’» Setup Development and Testing Environment on MacOS
Software Engineer
Software Engineer
September 19, 2022
2 min

Table Of Contents

01
Software Developer's Tech Stack
02
Install Utilities
03
Install Homebrew & Update Git
04
Create CaseSensitive- APFS Volumes & Setup Workplace Folder
05
Setup Java
06
Install Python
07
Install Ruby Languages
08
Install NodeJS
09
Install AWS CLI
10
Finished & Post Setup

🎯 Getting started with MacOS development and testing on a MacOS. Using VSCode and the Remote SSH extension, you can connect to remote servers.

Software Developer’s Tech Stack

  • Front-End:

    • TypeScript, HTML/CSS/JavaScript
    • React, React Native, Next.js
  • Back-End:

    • NodeJS 16.x, Redis
    • Python 3.9
    • SQL: SQLite, MySQL/MariaDB, Postgres
    • NoSQL: MongoDB, DynamoDB

Install Utilities


  • ✍️ NOTE: This guide assumes you are using ZSH as your shell.
    • If running echo $SHELLΒ in your Terminal returns /bin/zsh, then you shouldn’t run into any issues.
    • If you are using Bash (/bin/bashΒ is returned instead), then changeΒ ~/.zshrcΒ toΒ ~/.bash_profileΒ whenever you are exporting variables.

Install Homebrew & Update Git

## Install Homebrew from the Git repository

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

## Follow along with the prompts to complete the installation. 
## You may want to restart the Terminal after installation to make sure the PATH variable is set correctly
## If you see a warning during installation such as
## Warning: /usr/local/bin is not in your PATH, then add it to the PATH
# export PATH=/usr/local/bin:$PATH
## Install Ruby to use Amazon Homebrew formulas without sudo
# brew install ruby
## REQUIRED: Turn off Homebrew analytics
brew analytics off

Update Git

## Install an updated version of Git
brew install git
## Check if your username and email are configured correctly in Git
git config --list
## If either your username or email is not set properly, then update it with the respective command
git config --global user.name "Thanh Nguyen"
git config --global user.email nnthanh101@gmail.com

Create CaseSensitive- APFS Volumes & Setup Workplace Folder

  • ⚠️ WARNING:
    • This is the only part in this guide that has the potential to render data unusable. Trying to use the tool to create a workplace volume if it already exists can cause your encryption key to be overwritten. Unless you made a copy of the key you will end up having to erase the volume all together - potentially causing you to lose work contained within the workspace volume.
    • Your Disk Utility program should now have the volumes, make sure under the name it says: APFS Volume - APFS Volume (Case-sensitive Encrypted)

Setup Workplace Folder

## Change to your user directory
cd ~/
## Check if the workplace folder exists
ls -l workplace
## If you see "workplace -> /Volumes/workplace" continute to Part 4
## If you see "ls: workplace: No such file or directory" create the symlink
ln -s /Volumes/workplace ~/workplace
## Otherwise, if you see some other output, you already have a workplace folder but it is not linked to the encrypted volume. 
## You may want to consider moving that content to a new folder (eg workplace_old) and then create the symlink with the above command. 
## This will make following future commands and guides easier since they all assume you have the workplace folder.
## Ask for help if you need it since getting this wrong will make the rest of the guide much harder.
## Check if the workplace folder symlink is correct
ls -l workplace
## βœ… You should see "workplace -> /Volumes/workplace"

Setup Java

Bash note: if using Bash then change ~/.zshrc to ~/.bash_profile here.

## Add JAVA_HOME to your environment permanently - version 11 is currently recommended
echo "export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Content
## Verify that this is in ~/.zshrc or ~/.bash_profile
cat ~/.zshrc
## OR
# cat ~/.bash_profile

Install Python

Note: if python-buildΒ fails due to β€œzipimport.ZipImportError: can’t decompress data; zlib not available” go here Β first.

Bash note: if using Bash then change ~/.zshrc to ~/.bash_profile here.

## Install the prerequisites from Homebrew
brew install pyenv xz

## Add pyenv init to your environment to enable shims
# echo - e 'if command -v pyenv 1 >/dev/null 2 >&1; then\n eval "$(pyenv init -)"\nfi' >>
## OR for Bash
# echo -e 'if command -v pyenv 1 >/dev/null 2 >&1; then\n eval "$(pyenv init -)"\nfi' >>

## Reload your environment
source ~/.zshrc
## If using bash
# source ~/.bash_profile

## Setup the recommended Python versions
# python-build 3.8.3 ~/.runtimes/Python 38
python-build 3.9.14 ~/.runtimes/Python 39

Install Ruby Languages

## Install the prerequisites from Homebrew
brew install rbenv libyaml libffi

## Set up the recommended Ruby version for Brazil
ruby-build 2.5. 8Β  ~/.runtimes/Ruby 25 x

Install NodeJS

## Install NodeJS (version 16.x) from Homebrew
brew install node@16

Install AWS CLI

  • Note: if AWS CLI is version 1 then go here to install AWS CLI version 2.

    ## Check if AWS CLI version 2 is already installed
    aws --version
    ## If you see "aws-cli/2.0.0" or higher then continue
    ## If you see "zsh: command not found: aws" then download the package from below --> Download [AWS CLI version 2](https://awscli.amazonaws.com/AWSCLIV2.pkg)
    
  • Set Up AWS CLI Config File: AWS CLI v2 utilizes a config file to store frequently used configurations and credentials.

    ## Make sure ~/.aws exists
    ls ~/.aws
    ## If you see an error saying no such file or directory then create it
    mkdir ~/.aws
    ## Edit the config file
    nano ~/.aws/config
    
  • Add the following to your AWS CLI config file.

    [default]
    output=json
    region=ap-southeast-2
    
    ## (Optional) Add a named profile - boto 3 has issues assuming named profiles
    [profile oceansoft]
    output=json
    region=ap-southeast-2
    
  • To exit Nano, press Control+X, β€œY” to accept changes, and then Return to save the file at /Users/<ALIAS>/.aws/config. After, enter the following in the Terminal.

    ## Check AWS CLI is working well
    aws s3 ls
    ## (Optional) Check that your named profile works
    aws s3 ls --profile oceansoft
    ## If successful, you should see a list of your S3 buckets and AWS CLI is successfully using temporary credentials
    

Finished & Post Setup

If you followed along with this guide you should now have a working MacOS environment set up for development work. The Post Setup steps following this guide are needed every time you set up a new workspace for development work.

Create Python 3 Venv

## Create a workspace for your development work
mkdir ~/workplace/<WORKSPACE_NAME>
## Change into the workspace directory
cd ~/workplace/<WORKSPACE_NAME>

## List the Python versions you have installed with pyenv
pyenv versions
## If you don't have the version installed that you want to use then list all versions available to install
pyenv install --list
## Or only list Python versions 3.7, 3.8, or 3.
pyenv install --list | grep " 3 \.[ 6789 ]"
## Install the version you want to use - this takes some time
pyenv install <VERSION>
## Set the local Python version within the workspace
pyenv local <VERSION>
## Make sure you are using the correct Python version
python --version
## Create the Python virtual environment and store it in the "env" directory
python 3Β  - m venv venv
## Activate the virtual environment - you must do this every time you start a new shell.
## You can tell you are in the virtual environment if you see
## (env) at the beginning of your Terminal line
source env/bin/activate
## You are now ready to create Python code within a virtual environment.
## Running pip install will install packages to your "env" directory and
## will not make changes to your system packages.

## After you are finished working in the virtual environment you can deactivate it.
deactivate

Install Docker

  • Example Resource Settings:

    • MacBook - 4 core CPU, 16GB Memory, 250GB SSD Disk
    • Docker - 2 CPU, 4GB Memory, 32GB Disk
  • docker system prune --all --force

    docker-desktop

Docker is a tool used to run containerized applications. In the event that you require it for a project, Docker can be installed by following the instructions at

During the installation it is recommend that you modify the system resources reserved for Docker ( (2 CPUs and 2 GB RAM). If you are only running a few containers at a time then the default settings will be adequate. This will also leave more resources for your actual MacBook to consume if you leave Docker running in the background.


  • Lambda runtimes

    • nodejs16.x
    • python3.9
    • go1.x
    • java11 >> amazon-corretto-11
    • ruby2.7
    • dotnet6
  • Enable SSH Kerberos

βœ… You may need to restart your computer after installing the above packages. πŸš€


Tags

#application-migration#system-engineer#tutorial
Software Engineer

Software Engineer

FullStack Developer

Interprets specifications, technical designs and flow charts, builds, maintains and modifies the code for software applications, constructs technical specifications from a business functional model, and tests and writes technical documentation.

Expertise

TypeScript
NodeJS
Python

Social Media

githubwwwwww

Related Posts

Dockerizing Strapi - Open-Source NodeJS Headless CMS
Dockerizing Strapi - Open-Source NodeJS Headless CMS
September 22, 2022
3 min

Quick Links

🌏 About UsπŸ“Έ YoutubeπŸ’Œ Contact Us

Social Media