-
Notifications
You must be signed in to change notification settings - Fork 19
Apple's M1 & M2 Setup
How to verify that you have an Apple Silicon processor:
- Click the Apple icon in the top-left of the screen
- Click 'About This Mac'
- Look for the 'Chip' section at the top of the list
- Apple Silicon processors will begin with 'Apple'; as of 8/2024, these a variant of 'Apple M1', 'Apple M2', 'Apple M3', or 'Apple M4'
Frequently Asked Question:
- I am running into errors! Where can I go for help?
See the Installation Workarounds section for common or previously relevant workarounds that may help. Additionally, join the #bid_appeals_mac_support channel in Slack (or ask your scrum master to add you). You can search that channel to see if your issue has been previously discussed or post what step you are having a problem on and what you've done so far.
Important
Ensure command line tools are installed via Self Service Portal prior to starting
If the command line tools are already installed, make sure you update it to the latest version by going to the System Settings Application -> General Settings -> Software Updates
Follow these instructions as closely as possible. If a folder is specified for running terminal commands, ensure you are in that directory prior to running the command(s). If you can't complete a step, ask for help in the #bid_appeals_mac_support channel of the Benefits Integrated Delivery (BID) Slack workspace.
-
Create a
~/dev/appeals/
directory -
Clone the following repo using
git clone
into this directory -
Optional for setting up a machine, though you may work with these in the future
- https://github.com/department-of-veterans-affairs/caseflow-commons.git
- https://github.com/department-of-veterans-affairs/caseflow-frontend-toolkit.git
- https://github.com/department-of-veterans-affairs/caseflow-efolder.git
- https://github.com/department-of-veterans-affairs/caseflow-facols.git
- https://github.com/department-of-veterans-affairs/appeals-notebook.git
-
If you cannot clone the above, you might need to do this setup
- Install homebrew from self-service portal
Note: We do not use Docker Desktop due to licensing. We recommend using Colima to run the docker service.
- Open terminal and run:
brew install docker docker-compose colima
mkdir -p ~/.docker/cli-plugins
ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
- Download UTM from this link
- Right click UTM.app and select “install with privilege management” then open the UTM.app
- Download the Vacols VM from this link
- After the file downloads, right click on it in “Finder” and select “Show Package Contents” and delete the view.plist file if it exists
- Right click on the application and select “Open With > UTM.app (default)”
- Select the “Play” button when it pops up in UTM
- Leave this running in the background. If you close the window, you can open it back up by repeating steps 5-7
Note: You may need to restart your machine in between installing each of the packages.
- Open terminal and run
brew install --cask chromedriver
- Once it successfully installs, run command
chromedriver –version
- There will be a pop up. Before clicking “OK,” navigate to System Settings > Privacy & Security
- Scroll down to the security section and it will say “chromedriver was blocked from use because it is not from an identified developer”
- Select “Allow Anyway”
- Also in the Security section click on Developer Tools and add Terminal to the list of applications
- Select “Yes” from pop up
- Reopen terminal and once again run
chromedriver –version
- Select “Open”
- Restart your computer
- Download and install from this link. When you receive a security warning, follow steps 3-6 for PDFtk server. Note: You if you run into to issues you may need to restart you computer
- Restart your computer
- Download this file and move through the prompts. When you receive a security warning, follow steps 3-6 for wkhtmltox
- Download these DMG files
- After downloading, double click on one of the folders and follow the instructions in INSTALL_IC_README.txt to copy the libraries
- Download and install from this link
- Run command
open ~/.zshrc
- Add the following lines, ensuring that you have a newline at the end of the file:
# Add homebrew binaries to the PATH
export PATH=/opt/homebrew/bin:${PATH}
# Add Postgres environment variables for CaseFlow
export POSTGRES_HOST=localhost
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=postgres
export NLS_LANG=AMERICAN_AMERICA.UTF8
export FREEDESKTOP_MIME_TYPES_PATH=/opt/homebrew/share/mime/packages/freedesktop.org.xml
# InstantClient directory for ruby-oci8 gem
export OCI_DIR=$HOME/Downloads/instantclient_23_3
# Provide path to docker daemon in case there are issues finding it in the terminal
export DOCKER_HOST="unix://$HOME/.colima/docker.sock"
- Save file
- Go to your active terminal and enter source ~/.zshrc, or exit and open a new terminal
- In the Caseflow root directory, open the file
Gemfile
- Verify/update the PG gem to 1.5.7:
gem "pg", "~> 1.5.7"
- Verify/update the ruby-oci8 gem to 2.2.14:
gem "ruby-oci8", "~> 2.2.14"
Either run the following commands in order, or copy/paste them into a script in your home directory and execute it:
#!/bin/bash
# cleanup old directories; new installations may not have any of these, but it does not hurt to run them
rm -rf ~/homebrew
rm -rf ~/.asdf
rm -rf ~/.docker
rm -rf ~/.nodenv
rm -rf ~/.nvmrc
rm -rf ~/.nvm
rm -rf ~/.rbenv
rm -rf ~/.gem
rm -rf ~/.pyenv
# apple command line utils, if not already installed
xcode-select --install
# install brew applications
brew install coreutils curl gpg gawk asdf pyenv libpq yarn -f
# configure asdf in .zshrc file
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
# add nodejs as asdf package mgr and install node
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs 16.16.0
# add ruby as asdf package mgr and install ruby
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby 2.7.3
# add python to asdf and install
asdf plugin add python https://github.com/asdf-community/asdf-python
asdf install python 3.10.7
# source .zshrc file to activate asdf
. ~/.zshrc
# change to caseflow dir
cd ~/dev/appeals/caseflow
# set node and ruby versions in caseflow directory
asdf local nodejs 16.16.0
asdf local ruby 2.7.3
asdf local python 3.10.7
node -v
ruby -v
python --version
# set up the Makefile
ln -s Makefile.example Makefile
# install gems that require a little more work that bundle install will provide
gem install bundler:2.4.22
gem install msgpack -v 1.4.2 -- --with-cflags="-Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types"
gem install debase -v 0.2.4.1 -- --with-cflags="-Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types"
# set bundler config options for installing the pg gem
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
make install
# if you get an error when running make install due to the PG gem, run the command below and then re-run make install:
# gem install pg:1.5.7 -- --with-cflags="-Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
To excutable run:
chmod 755 YourScriptName.sh
./YourScriptName.sh
- Ensure you are on the main branch and up to date by running
git checkout main
git fetch
git pull origin main
- Start Vacols UTM VM (if not already running)
- Run
make up-m1
to create the docker containers and volumes - Run
make reset
to (re)create and seed the database; this may take a while depending on which branch you are on (anywhere from 5 mintues up to ~45 minutes)- If you get a database not found error, run
bundle exec rake db:drop db:create db:schema:load
, and then runmake reset
again
- If you get a database not found error, run
- Open a second terminal tab/window
- Run
make run-backend-m1
in one tab, andmake run-frontend
in the other- The backend should launch on
localhost:3000
. Go there in your browser to access Caseflow - The frontend launches on
localhost:3500
; This is a server that enables hot-reloading of modules during development. Going to this address in a browser will not work - Optionally, you can do
make run-m1
to launch both at the same time with Foreman, but if one server errors the other can remain running and lead to headache trying to get them back up
- The backend should launch on
- Start the VACOLS VM via UTM; login is not required
- In terminal, run
colima start
to start the docker daemon - In terminal, go to the caseflow directory and run:
-
make up-m1
to start the docker containers
-
- Open a second terminal window/tab, and from the caseflow directory run:
-
make run-backend-m1
in one tab -
make run-frontend
in the other tab
-
Note: It takes several minutes for the VACOLS VM to go through its startup and launch the Oracle DB service, and about a minute for the Postgres DB to initialize after running make up-m1
.
Only follow the below instructions if you have problems with openssl@3 or [email protected] not compiling.
- There have been issues in the past with compiling openssl 1.1.1 and openssl 3, which were worked around by sharing precompiled files to devs who are seeing the problem. This was likely a problem with our previous setup, where we needed to have an x86_64 homebrew installed alongside the standard arm64 homebrew. If you run into this issue following these instructions, post in the #bid_appeals_mac_support channel channel for support.
During the gem installation if you are seeing errors indicating
DESTDIR: command not found
make sure the xcode command line tools installed are up-to-date
The following steps are an alternative to step 7 of the Running Caseflow section in the event that you absolutely cannot get those commands to work:
- In caseflow, run
- a.
make down
- i. Removes appeals-db, appeals-redis, and localstack docker containers
- b.
docker-compose down –v
- i. Removes caseflow_postgresdata docker volume
- c.
make up-m1
- i. Starts docker containers, volume, and network
- d.
make reset
- i. Resets caseflow and ETL database schemas, seeds databases, and enables feature flags
- **If
make reset
returns database not found error:- a. Run command
bundle exec rake db:drop
- b. Download caseflow-db-backup.gz (not able to share this download via policy, ask in the slack channel)
- c. Enter terminal, navigate to ~/Downloads
- e. Run command
- i.
gzip -dck caseflow-db-backup.gz | docker exec -i appeals-db psql -U postgres
- ii. (this command will link the caseflow_certification_database to docker)
- i.
- f. Enter terminal, navigate to caseflow, and run
- i.
make up-m1
- ii.
make reset
(this will take a while)
- i.
- a. Run command
- a.
Deprecated instructions; do not use unless specifically directed
How to verify that you have an Apple Silicon processor:
- Click the Apple icon in the top-left of the screen
- Click 'About This Mac'
- Look for the 'Chip' section at the top of the list
- Apple Silicon processors will begin with 'Apple'; as of 7/2023, these a variant of 'Apple M1' or 'Apple M2'
Frequently Asked Question:
- Why is this so complicated?
Apple Silicon processors use a different architecture (arm64/aarch64) than Intel processors (x86_64). Oracle, which is used for the VACOLS database, does not have binaries to run any of their database tools natively on arm64 for MacOS. To work around this we use Rosetta to emulate x86_64 processors in the terminal, installing most of the Caseflow dependencies via the x86_64 version of Homebrew. It is important that while setting up your environment, you ensure you are in the correct terminal type and in the correct directory so that you do not install or compile a dependency with the wrong architecture.
- I am running into errors! Where can I go for help?
See the Installation Workarounds section for common or previously relevant workarounds that may help. Additionally, join the #bid_appeals_mac_support channel in Slack (or ask your scrum master to add you). You can search that channel to see if your issue has been previously discussed or post what step you are having a problem on and what you've done so far.
Ensure command line tools are installed via Self Service Portal prior to starting
Follow these instructions as closely as possible. If a folder is specified for running terminal commands, ensure you are in that directory prior to running the command(s). If you can't complete a step, ask for help in the #bid_appeals_mac_support channel of the Benefits Integrated Delivery (BID) Slack workspace.
-
Create a
~/dev/appeals/
directory -
Clone the following repo using
git clone
into this directory -
Optional for setting up a machine, though you may work with these in the future
- https://github.com/department-of-veterans-affairs/caseflow-commons.git
- https://github.com/department-of-veterans-affairs/caseflow-frontend-toolkit.git
- https://github.com/department-of-veterans-affairs/caseflow-efolder.git
- https://github.com/department-of-veterans-affairs/caseflow-facols.git
- https://github.com/department-of-veterans-affairs/appeals-notebook.git
-
If you cannot clone the above, you might need to do this setup
- Install homebrew from self-service portal
Note: We do not use Docker Desktop due to licensing. We recommend using Colima to run the docker service.
- Open terminal and run:
brew install docker docker-compose colima
mkdir -p ~/.docker/cli-plugins
ln -sfn /opt/homebrew/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
- Download UTM from this link
- Right click UTM.app and select “install with privilege management” then open the UTM.app
- Download the Vacols VM from this link
- After the file downloads, right click on it in “Finder” and select “Show Package Contents” and delete the view.plist file if it exists
- Right click on the application and select “Open With > UTM.app (default)”
- Select the “Play” button when it pops up in UTM
- Leave this running in the background. If you close the window, you can open it back up by repeating steps 5-7
Note: You may need to restart your machine in between installing each of the packages.
- Open terminal and run
brew install --cask chromedriver
- Once it successfully installs, run command
chromedriver –version
- There will be a pop up. Before clicking “OK,” navigate to System Settings > Privacy & Security
- Scroll down to the security section and it will say “chromedriver was blocked from use because it is not from an identified developer”
- Select “Allow Anyway”
- Select “Yes” from pop up
- Reopen terminal and once again run
chromedriver –version
- Select “Open”
- Download and install from this link. When you receive a security warning, follow steps 3-6 for PDFtk server
- Download this file and move through the prompts. When you receive a security warning, follow steps 3-6 for wkhtmltox
- Download these DMG files
- After downloading, double click on one of the folders and follow the instructions in INSTALL_IC_README.txt to copy the libraries
- Download and install from this link
Run the below commands from your home directory
- In a terminal, create a homebrew directory under your home directory
mkdir homebrew
- In a terminal, run
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
- If you get a chdir error, run
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
- Open standard terminal and run:
softwareupdate -–install-rosetta –-agree-to-license
- Once Rosetta is installed, find the default terminal in “Finder” > Applications
- Right click and select “Get Info”
- Select “Open using Rosetta”
- Run command
open ~/.zshrc
- Add the following lines, if any of these are already set make sure to comment previous settings:
export PATH=~/homebrew/bin:${PATH}
eval "$(~/homebrew/bin/rbenv init -)"
eval "$(~/homebrew/bin/nodenv init -)"
eval "$(~/homebrew/bin/pyenv init --path)"
# Add Postgres environment variables for CaseFlow
export POSTGRES_HOST=localhost
export POSTGRES_USER=postgres
export POSTGRES_PASSWORD=postgres
export NLS_LANG=AMERICAN_AMERICA.UTF8
export FREEDESKTOP_MIME_TYPES_PATH=~/homebrew/share/mime/packages/freedesktop.org.xml export OCI_DIR=~/Downloads/instantclient_19_8
- Save file
- Go to your active terminal and enter source ~/.zshrc or create a new terminal
Note: until rbenv, nodenv, and pyenv are installed, the eval
commands will display a 'command not found' error when launching a terminal
VERY IMPORTANT NOTE: The below commands must be run in a Rosetta terminal until you reach the 'Running Caseflow' section
Script 1
- Enter a Rosetta terminal and ensure you are in the directory you cloned Caseflow repo into (~/dev/appeals/caseflow) and run commands:
git checkout grant/setup-m1
./scripts/dev_env_setup_step1.sh
- If this fails, double check your .zshrc file to ensure your PATH has only the x86_64 brew
Note: If you run into errors installing any versions of openssl, see the "Installation Workarounds" section at the bottom of this document
Script 2
- In the Rosetta terminal, install pyenv and the required python2 version:
brew install pyenv
pyenv rehash
pyenv install 2.7.18
- In the caseflow directory, run
pyenv local 2.7.18
to set the version
- In the Rosetta terminal navigate to caseflow folder:
- Run
rbenv install $(cat .ruby-version)
- Run
rbenv rehash
- Run
gem install bundler -v $(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)
- Run
gem install pg:1.1.4 -- --with-cflags="-Wno-error=implicit-function-declaration -Wno-error=incompatible-function-pointer-types" --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
- Run
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
- Run
./scripts/dev_env_setup_step2.sh
- Run
NOTE: If you get a permission error while running gem install or bundle install, something went wrong with your rbenv install which needs to be fixed.
- If there are no errors messages, run
bundle install
to ensure all gems are installed
VERY IMPORTANT NOTE TWO: This is where you switch back to a standard (non-Rosetta) terminal
- Once your installation of all gems is complete, switch back to a standard MacOS terminal:
- Open your ~/.zshrc file
- Comment the line
export PATH=~/homebrew/bin:$PATH
- Uncomment the line
export PATH=/opt/homebrew/bin:$PATH
- Add the line
export PATH=$HOME/.nodenv/shims:$HOME/.rbenv/shims:$HOME/.pyenv/shims:$PATH
- Comment the lines
eval "$({binary} init -)"
for rbenv, pyenv, and nodenv if applicable - If you added the line
eval $(~/homebrew/bin/brew shellenv)
after installing x86_64 homebrew, comment it out
- Open a terminal verify:
- that you are on arm64 by doing
arch
and checking the output - that you are using arm64 brew by doing
which brew
and ensuring the output is/opt/homebrew/bin/brew
- that you are on arm64 by doing
- Open caseflow in VSCode (optional), or navigate to the caseflow directory in your terminal and:
brew install yarn
- Ensure you are on main branch and up to date by running
git checkout main
git fetch
git pull origin main
- Start Vacols UTM VM (if not already running)
- Run
make up-m1
to create the docker containers and volumes - Run
make reset
to (re)create and seed the database; this may take a while depending on which branch you are on (anywhere from 5 mintues up to ~45 minutes)- If you get a database not found error, run
bundle exec rake db:drop db:create db:schema:load
, and then runmake reset
again
- If you get a database not found error, run
- Open a second terminal tab/window
- Run
make run-backend-m1
in one tab, andmake run-frontend
in the other- The backend should launch on
localhost:3000
. Go there in your browser to access Caseflow - The frontend launches on
localhost:3500
; This is a server that enables hot-reloading of modules during development. Going to this address in a browser will not work - Optionally, you can do
make run-m1
to launch both at the same time with Foreman, but if one server errors the other can remain running and lead to headache trying to get them back up
- The backend should launch on
- Start the VACOLS VM via UTM; login is not required
- In terminal, run
colima start
to start the docker daemon - In terminal, go to the caseflow directory and run:
-
make up-m1
to start the docker containers
-
- Open a second terminal window/tab, and from the caseflow directory run:
-
make run-backend-m1
in one tab -
make run-frontend
in the other tab
-
Note: It takes several minutes for the VACOLS VM to go through its startup and launch the Oracle DB service, and about a minute for the Postgres DB to initialize after running make up-m1
.
When installing rbenv, nodenv, or pyenv, both openssl libraries should install as dependencies. Only follow the below instructions if you have problems with openssl@3 or [email protected] not compiling.
- Download [email protected] and openssl@3 from this link
- Open “Finder” and find the two folders under “Downloads”
- Extract the
.tar.gz
or.zip
archives - In each of the extracted folders:
- Navigate to the
~/homebrew/Cellar
subfolder - Copy the openssl folder to your local machine's
~/homebrew/Cellar
folder - If the folder
Cellar
in~/homebrew
does not exist, create it withmkdir ~/homebrew/Cellar
- Note: moving these folders can be done using finder or a terminal
- Navigate to the
- Run command (from a rosetta terminal)
brew link --force [email protected]
- If the one above doesn’t work run:
brew link [email protected] --force
- Note: don't link openssl@3 unless you run into issues farther in the setup
If you are getting errors for rbenv being unable to find a usable version of openssl, run these commands prior to running the second dev setup script:
brew install [email protected]
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/homebrew/Cellar/[email protected]"
The following steps are an alternative to step 7 of the Running Caseflow section in the event that you absolutely cannot get those commands to work:
- In caseflow, run
- a.
make down
- i. Removes appeals-db, appeals-redis, and localstack docker containers
- b.
docker-compose down –v
- i. Removes caseflow_postgresdata docker volume
- c.
make up-m1
- i. Starts docker containers, volume, and network
- d.
make reset
- i. Resets caseflow and ETL database schemas, seeds databases, and enables feature flags
- **If
make reset
returns database not found error:- a. Run command
bundle exec rake db:drop
- b. Download caseflow-db-backup.gz (not able to share this download via policy, ask in the slack channel)
- c. Enter terminal, navigate to ~/Downloads
- e. Run command
- i.
gzip -dck caseflow-db-backup.gz | docker exec -i appeals-db psql -U postgres
- ii. (this command will link the caseflow_certification_database to docker)
- i.
- f. Enter terminal, navigate to caseflow, and run
- i.
make up-m1
- ii.
make reset
(this will take a while)
- i.
- a. Run command
- a.
- Home
- Acronyms and Glossary
- Caseflow products
- Caseflow Intake
- Caseflow Queue
- Appeals Consumer
- Caseflow Reader
- Caseflow eFolder
- Caseflow Hearings
- Caseflow Certification
- Caseflow APIs
- Appeal Status API
- Caseflow Dispatch
-
CSUM Roles
- System Admin
- VHA Team Management
- Active Record Queries Resource
- External Integrations
- Caseflow Demo
- Caseflow ProdTest
- Background
- Stuck Jobs
- VA Notify
-
Caseflow-Team
- Tier 4
- Bat Team
- Technical Documentation
- Backend Code Patterns
- Backend Working Group
- FACOLS, VACOLS DB Schema
- Asyncable Models
- External Data: where and why
- Data Fetching Scripts
- Caseflow Data Model and Dictionary
- User Access Permissions
- Controller Schemas
- Constants
- Frontend Best Practices
- Accessibility
- How-To
- Debugging Tips
- Adding a Feature Flag with FeatureToggle
- Editing AMA issues
- Editing a decision review
- Fixing task trees
- Investigating and diagnosing issues
- Data and Metric Request Workflow
- Exporting and Importing Appeals
- Explain page for Appeals
- Record associations and Foreign Keys
- Upgrading Ruby
- Stuck Appeals
- Testing Action Mailer Messages Locally
- Re-running Seed Files
- Rake Generator for Legacy Appeals
- Manually running Scheduled Jobs
- System Admin UI
- Caseflow Makefile
- Upgrading Postgresql from v11.7 to v14.8 Locally
- VACOLS VM Trigger Fix M1
- Using SlackService to Send a Job Alert
- Technical Talks