Install Linuxbrew for non-sudo package management

less than 1 minute read

Linuxbrew is a fork of Mac homebrew, allowing install of the latest compilers and other packages without sudo.

  1. Use the Linuxbrew install script, which installs Ruby and Linuxbrew
  2. Press Ctrl-D when asked for the password to install to ~/.linuxbrew without sudo.
  3. install desired packages. Gfortran comes with
    brew install gcc
    

Generally the latest compilers are available from Linuxbrew, as will homebrew for Mac.

Linuxbrew environment variables

Instead of putting the Linuxbrew variables into ~/.bashrc, consider putting them into ~/brew.sh, where you can activate them when needed, instead of constantly being active. Either choice is fine of course.

  1. create ~/brew.sh containing:
    #!/bin/bash
    
    PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
    MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH"
    INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH"
    HOMEBREW_EDITOR="gedit"
    
  2. anytime you want to use Linuxbrew, type
    . ~/brew.sh
    

    upon closing the terminal, the configuration falls back to default (non-Linuxbrew)

Categories:

Updated:

Leave a comment