MacPorts

Installation

https://www.macports.org/

Configuration

after installation, better to do below configurations :

export PATH=$PATH:/opt/local/bin
export MANPATH=$MANPATH:/opt/local/share/man
export INFOPATH=$INFOPATH:/opt/local/share/info

Test

$ port version
Version: 2.5.4

Yarn installation with MacPorts

$ sudo port install yarn