macOS Homebrew without sudo

Homebrew is a popular framework for quickly installing development tools on macOS, including Gfortran. macOS cloud services such as MacInCloud may say they provide Homebrew, but you may not be able to install packages without a sudo/admin account. To install Homebrew without sudo/admin in the user home directory for cloud or physical hardware, follow these steps:

mkdir homebrew && curl -L | tar xz --strip 1 -C homebrew

Edit ~/.profile to include

export PATH=$HOME/homebrew/bin:$PATH

Open a new Terminal to use Homebrew.

If one truly doesn’t have sudo/admin access as typical with a managed (less-expensive) cloud macOS plan, and if Xcode is not the appropriate version, GCC may compile from source, which can take tens of minutes. This may occur when doing

brew install gcc

Reference: Homebrew without sudo script