-
You will need
brew
aka Homebrew for package management. -
It is highly recommended that you install a python environment manager. Two options are:
-
pyenv (recommended) and
pyenv-virtualenv
brew install pyenv pyenv-virtualenv
To create a new HQ virtual environment running Python 3.9.11, you can do the following:
pyenv virtualenv 3.9.11 hq
Then to enter the environment:
pyenv activate hq
-
Please note that if you use
virtualenvwrapper
, you also need to installpip
To install
pip
:sudo python get-pip.py
Then install
virtualenvwrapper
withpip
:sudo python3 -m pip install virtualenvwrapper
-
-
Java (JDK 17)
We recommend using
sdkman
as a Java environment manager.jenv
is also an option, though more involved.-
Example setup using
sdkman
:-
List available java versions to file one that matches Java (JDK 17)
sdk list java | grep 17
Look for Java 17 in the list and install, eg:
sdk install java 17.0.8-zulu
-
Example setup using
jenv
:-
Download and install Java SE Development Kit 17 from oracle.com downloads page.
-
Install
jenv
brew install jenv
-
Configure your shell (Bash folks use
~/.bashrc
instead of~/.zshrc
below):echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc echo 'eval "$(jenv init -)"' >> ~/.zshrc
-
Add JDK 17 to
jenv
:jenv add $(/usr/libexec/java_home)
-
Verify
jenv
config:jenv doctor
-
-
-
psycopg2
will complainAs of Mac OS 11.x Big Sur, the solution for this is:
brew install libpq --build-from-source export LDFLAGS="-L/opt/homebrew/opt/libpq/lib" pip install psycopg2-binary
Or try: (reference). Used on Mac OS 12.X Monterey.
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib" export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
-
pip install xmlsec
givesImportError
Due to issues with recent versions of
libxmlsec1
(v1.3 and after)pip install xmlsec
is currently broken. This is a workaround. This solution also assumes yourhomebrew
version is greater than4.0.13
*:
- run
brew unlink libxmlsec1
- overwrite the contents of
/opt/homebrew/opt/libxmlsec1/.brew/libxmlsec1.rb
with this formula. - install that formula (
brew install /opt/homebrew/opt/libxmlsec1/.brew/libxmlsec1.rb
) - run
pip install xmlsec
(*)The path to libxmlsec1.rb
might differ on older versions of homebrew
If it still won't install, this answer and thread are good starting points for further diagnosing the issue.
-
gevent
may present errors when installing with Python <3.9. For this reason, you should avoid using an older version of Python unless it is required. -
pynacl
will likely install but may throw an errorsymbol not found in flat namespace '_ffi_prep_closure'
when attempting to run, particularly when setting up CommCare-Cloud.This can be fixed by installing a version of
pynacl
specific to the system architecture:arch -arm64 pip install --upgrade --force-reinstall pynacl
Docker images that will not run on Mac OS (Intel or M1):
formplayer
(See section on Running Formplayer Outside of Docker in the Main Developer Setup Guide)
Docker images that will not run on Mac OS (as of 11.x Big Sur and above):
elasticsearch5
./scripts/docker up -d postgres couch redis zookeeper kafka minio
Note: kafka
will be very cranky on start up. You might have to restart it if you see kafka
errors.
./scripts/docker restart kafka
First, ensure that you have Java 8 running. java -version
should output something like openjdk version "1.8.0_322"
.
Use sdkman
or jenv
to manage your local java versions.
Download the tar
file for elasticsearch 5.6.16
Un-tar and put the folder somewhere you can find it. Take note of that path (pwd
) and add the following to your ~/.zshrc
:
export PATH="/path/to/elasticsearch-5.6.16/bin:$PATH"
NOTE: Make sure that /path/to
is replaced with the actual path!
After this you can open a new terminal window and run elasticsearch with elasticsearch
.
If running elasticsearch
throws errors related to JVM options, such as...
Unrecognized VM option 'UseConcMarkSweepGC'
Error: Could not create the Java Virtual Machine.
...try commenting out those options in the relevant config file: inside of your elasticsearch directory
(which elasticsearch
), these may be set in bin/elasticsearch.in.sh
or in config/jvm.options
).
Now that you have Elasticsearch running you will need to install the necessary plugins:
-
Install the plugin
$ elasticsearch-plugin install analysis-phonetic
(If the
plugin
command is not found you will need to use the full path<es home>/bin/plugin
). -
Restart the service
-
Verify the plugin was correctly installed
$ curl "localhost:9200/_cat/plugins?s=component&h=component,version" > analysis-phonetic 5.6.16
FYI, be sure to check out the FAQ on elasticsearch.
To refresh specific indices in elasticsearch you can do the following...
First make sure everything is up-to-date
./manage.py ptop_preindex --reset
./manage.py preindex_everything
Force a re-index of forms
and cases
:
./manage.py ptop_reindexer_v2 sql-case --reset
./manage.py ptop_reindexer_v2 sql-form --reset
For other indices see ./manage.py ptop_reindexer_v2 --help