Skip to content

How to install FSL, pydeface, quickshear, mridefacer on your Mac for MRI defacing

Installing FSL

Run this in your terminal:

curl -Ls https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/getfsl.sh | bash

(or with sh if you prefer):

curl -Ls https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/releases/getfsl.sh | sh

What happens:

  • It downloads and installs FSL into ~/fsl by default (you can change the path when prompted).
  • It works on both Apple Silicon and Intel Macs.
  • Takes ~10–15 minutes on a good connection.

When it finishes you should see:

FSL successfully installed

After installation – set up the environment

Close the terminal and open a new one, or run:

source ~/.zshrc          # or ~/.bash_profile depending on your shell

Then check:

echo $FSLDIR
which bet
which flirt
bet --help

You should see paths under ~/fsl (or wherever you installed it).

Optional: put FSL on PATH permanently (if the installer didn’t do it)

Add these lines to ~/.zshrc:

# FSL
export FSLDIR=$HOME/fsl
source $FSLDIR/etc/fslconf/fsl.sh
export PATH=$FSLDIR/bin:$PATH

Then:

source ~/.zshrc

1. Python packages (pydeface + quickshear + dependencies)

conda activate base

pip install --upgrade pip
pip install nibabel numpy scipy scikit-image matplotlib pandas
pip install pydeface
pip install quickshear

2. mridefacer

cd ~
git clone https://github.com/mih/mridefacer.git
cd mridefacer
chmod +x mridefacer

# Add to PATH permanently
echo 'export PATH="$HOME/mridefacer:$PATH"' >> ~/.zshrc
source ~/.zshrc

3. AFNI

cd ~
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries

# Apple Silicon
tcsh @update.afni.binaries -package macos_13_ARM_clang

# Add to PATH
echo 'export PATH=$HOME/abin:$PATH' >> ~/.zshrc
source ~/.zshrc

4. Final verification

conda activate base

which pydeface
which quickshear
which mridefacer
which @afni_refacer_run
which bet
python -c "import nibabel, scipy, skimage, matplotlib; print('Python deps OK')"

Once all of these commands succeed, you are ready to run the comparison script with:

  • pydeface
  • AFNI @afni_refacer_run
  • mridefacer
  • quickshear
  • ZTD

Discover more from Knowledge sparks

Subscribe to get the latest posts sent to your email.

Leave a Reply

error: Content is protected !!