|
| 1 | +# Setup PhysiCell on macOS |
| 2 | + |
| 3 | +We will install everything PhysiCell related under the src folder that we will place in your home directory. |
| 4 | +If you prefer another folder name, please adjust the commands accordingly. |
| 5 | + |
| 6 | + |
| 7 | +## 🍎 Operating system dependencies. |
| 8 | + |
| 9 | +### ✨ Install Brew: |
| 10 | + |
| 11 | +Follow the instruction to download and install brew. |
| 12 | +Basically, copy the installation command, paste it into the Terminal (found at Applications / Utilities), and press the enter key. |
| 13 | + |
| 14 | ++ https://brew.sh/ |
| 15 | + |
| 16 | +Don't forget to put brew under your $PATH. |
| 17 | + |
| 18 | +```bash |
| 19 | +if ! grep -Fq '/opt/homebrew/bin' ~/.zshrc |
| 20 | +then |
| 21 | + echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.zshrc |
| 22 | +fi |
| 23 | +if ! grep -Fq '/opt/homebrew/bin' ~/.bash_profile |
| 24 | +then |
| 25 | + echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.bash_profile |
| 26 | +fi |
| 27 | +if ps -p $$ | grep zsh |
| 28 | +then |
| 29 | + source ~/.zshrc |
| 30 | +else |
| 31 | + source ~/.bash_profile |
| 32 | +fi |
| 33 | +``` |
| 34 | + |
| 35 | +### ✨ Install GCC, ImageMagick, and FFmpeg (required by PhysiCell): |
| 36 | + |
| 37 | +```bash |
| 38 | +brew install gcc imagemagick ffmpeg |
| 39 | +``` |
| 40 | + |
| 41 | + |
| 42 | +## 🍎 Basic PhyiCell installation |
| 43 | + |
| 44 | +### ✨ Install PhysiCell: |
| 45 | + |
| 46 | +Copy the installation command, paste it into the Terminal (found at Applications / Utilities), and press the enter key. |
| 47 | + |
| 48 | +```bash |
| 49 | +if [ -d ~/src/PhysiCell ] |
| 50 | +then |
| 51 | + echo "ERROR : /Users/$USER/src/PhysiCell already exists! please delete the folder if you want to do a reinstallation. installation terminated." |
| 52 | +else |
| 53 | + mkdir -p ~/src |
| 54 | + cd ~/src |
| 55 | + if ! grep -Fq 'export PHYSICELL_CPP=' ~/.zshrc |
| 56 | + then |
| 57 | + echo export PHYSICELL_CPP=$(bash -c "compgen -c" | grep -m 1 -e '^g++-[0-9]\+') >> ~/.zshrc |
| 58 | + fi |
| 59 | + if ! grep -Fq 'export PHYSICELL_CPP=' ~/.bash_profile |
| 60 | + then |
| 61 | + echo export PHYSICELL_CPP=$(bash -c "compgen -c" | grep -m 1 -e '^g++-[0-9]\+') >> ~/.bash_profile |
| 62 | + fi |
| 63 | + if ps -p $$ | grep zsh |
| 64 | + then |
| 65 | + source ~/.zshrc |
| 66 | + else |
| 67 | + source ~/.bash_profile |
| 68 | + fi |
| 69 | + curl -L https://github.com/MathCancer/PhysiCell/archive/refs/tags/$(curl https://raw.githubusercontent.com/MathCancer/PhysiCell/master/VERSION.txt).zip > download.zip |
| 70 | + unzip download.zip |
| 71 | + rm download.zip |
| 72 | + rm -fr PhysiCell |
| 73 | + mv PhysiCell-$(curl https://raw.githubusercontent.com/MathCancer/PhysiCell/master/VERSION.txt) PhysiCell |
| 74 | +fi |
| 75 | +``` |
| 76 | + |
| 77 | +### ✨ Test the PhyiCell installation with the template sample project: |
| 78 | + |
| 79 | +```bash |
| 80 | +cd ~/src/PhysiCell |
| 81 | +``` |
| 82 | +```bash |
| 83 | +make template |
| 84 | +``` |
| 85 | +```bash |
| 86 | +make -j8 |
| 87 | +``` |
| 88 | +```bash |
| 89 | +./project |
| 90 | +``` |
| 91 | +```bash |
| 92 | +make jpeg |
| 93 | +``` |
| 94 | +```bash |
| 95 | +make gif |
| 96 | +``` |
| 97 | +```bash |
| 98 | +make movie |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | +## 🍎 Essential installation |
| 103 | + |
| 104 | +We will generate a python3 environment with the default python installation, where we will install all PhysiCell modelling related python libraries. |
| 105 | +We will name this python3 environment pcvenv (PhysiCell virtual environment). |
| 106 | + |
| 107 | +### ✨ Install PhysiCell-Studio: |
| 108 | + |
| 109 | +Copy the installation command, paste it into the Terminal (found at Applications / Utilities), and press the enter key. |
| 110 | + |
| 111 | +```bash |
| 112 | +if [ -d ~/src/PhysiCell-Studio ] |
| 113 | +then |
| 114 | + echo "ERROR : /Users/$USER/src/PhysiCell-Studio already exists! please delete the folder if you want to do a reinstallation. installation terminated." |
| 115 | +else |
| 116 | + cd ~/src |
| 117 | + python3 -m venv pcvenv |
| 118 | + if ! grep -Fq 'alias pcvenv=' ~/.zshrc |
| 119 | + then |
| 120 | + echo "alias pcvenv=\"source /Users/$USER/src/pcvenv/bin/activate\"" >> ~/.zshrc |
| 121 | + fi |
| 122 | + if ! grep -Fq 'alias pcvenv=' ~/.bash_profile |
| 123 | + then |
| 124 | + echo "alias pcvenv=\"source /Users/$USER/src/pcvenv/bin/activate\"" >> ~/.bash_profile |
| 125 | + fi |
| 126 | + source /Users/$USER/src/pcvenv/bin/activate |
| 127 | + curl -L https://github.com/PhysiCell-Tools/PhysiCell-Studio/archive/refs/tags/v$(curl https://raw.githubusercontent.com/PhysiCell-Tools/PhysiCell-Studio/refs/heads/main/VERSION.txt).zip > download.zip |
| 128 | + unzip download.zip |
| 129 | + rm download.zip |
| 130 | + rm -fr PhysiCell-Studio |
| 131 | + mv PhysiCell-Studio-$(curl https://raw.githubusercontent.com/PhysiCell-Tools/PhysiCell-Studio/refs/heads/main/VERSION.txt) PhysiCell-Studio |
| 132 | + pip3 install -r PhysiCell-Studio/requirements.txt |
| 133 | + cd ~/src/pcvenv/bin/ |
| 134 | + echo "python3 /Users/$USER/src/PhysiCell-Studio/bin/studio.py \$*" > pcstudio |
| 135 | + chmod 775 pcstudio |
| 136 | + cd ~/src |
| 137 | +fi |
| 138 | +``` |
| 139 | + |
| 140 | +### ✨ Test the PhysiCell-Studio installation: |
| 141 | + |
| 142 | +```bash |
| 143 | +cd ~/src/PhysiCell |
| 144 | +pcvenv |
| 145 | +pcstudio |
| 146 | +``` |
| 147 | + |
| 148 | +### ✨ Official PhysiCell Studio manual: |
| 149 | + |
| 150 | ++ https://github.com/PhysiCell-Tools/Studio-Guide/tree/main |
| 151 | + |
| 152 | + |
| 153 | +## 🍎 Advanced installation |
| 154 | + |
| 155 | +### ✨ Install PhysiCell Data Loader (pcdl) and iPython: |
| 156 | + |
| 157 | +```bash |
| 158 | +pcvenv |
| 159 | +pip3 install pcdl ipython |
| 160 | +``` |
| 161 | +### ✨ Test the pcdl installation: |
| 162 | + |
| 163 | +```bash |
| 164 | +ipython |
| 165 | +``` |
| 166 | +```python |
| 167 | +import pcdl |
| 168 | +``` |
| 169 | +```python |
| 170 | +exit() |
| 171 | +``` |
| 172 | + |
| 173 | +### ✨ Official pcdl manual: |
| 174 | + |
| 175 | ++ https://github.com/PhysiCell-Tools/python-loader |
| 176 | + |
| 177 | + |
| 178 | +## 🍏 IDE VSCode integration (optional) |
| 179 | + |
| 180 | +1. Install vs code, either from your operating system’s app store or from https://code.visualstudio.com/ . |
| 181 | + |
| 182 | +2. Generate a vs code profile for physicell: |
| 183 | + |
| 184 | +``` |
| 185 | +File | New Window with Profile |
| 186 | +Name: physicell |
| 187 | +Icon: choose something cool. |
| 188 | +Create |
| 189 | +Add Folder: Users/<username>/src |
| 190 | +click the profile icon (default is a gearwheel) on the left side bottom corner. |
| 191 | +Profile > physicell |
| 192 | +``` |
| 193 | + |
| 194 | +3. Open the Folder: |
| 195 | + |
| 196 | +``` |
| 197 | +File | Open Folder… | src | Open |
| 198 | +Yes, I trust the authors |
| 199 | +``` |
| 200 | + |
| 201 | +4. Install the official python and C++ extensions into the profile: |
| 202 | + |
| 203 | +``` |
| 204 | +click the profile icon (default is a gearwheel) on the left side bottom corner. |
| 205 | +Profile > physicell |
| 206 | +Extension: Python Install |
| 207 | +Extension: C/C++ Install |
| 208 | +``` |
| 209 | + |
| 210 | +5. Link pcvenv (the python environment we generated above): |
| 211 | + |
| 212 | +``` |
| 213 | +View | Command Palette… | Python: Select Interpreter | |
| 214 | +Enter interpreter path… | Find… | src/pcvenv |
| 215 | +``` |
0 commit comments