This is a living document. Comments and contributions are most welcome!
Overview
It's not necessary to have Elevated Privileges (EP) to install and run many popular software libraries. Homebrew can often install a program for you without any manual configuration. When required, a manual installation consists of two keys steps: downloading the software package (e.g., a JAR or zip file) and adding the downloaded software to the PATH environmental variable, so your computer knows where to find it.
Homebrew
Homebrew offers several alternative methods of installation. The most relevant are the instructions labeled "Untar Anywhere" found on the official documentation page. Here's is a complete script for installing and running homebrew inside your user's home directory where you don't need EP.
# navigate to your home directory
cd ~/
# create a homebrew folder in your home directory
mkdir homebrew
# download homebrew software into your new folder
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
# add homebrew to zsh shell
echo 'export PATH="/Users/username/homebrew/bin:$PATH"' >> ~/.zshrc
# add homebrew to bash shell's profile (if applicable)
echo 'export PATH="/Users/username/homebrew/bin:$PATH"' >> ~/.bash_profile
# add homebrew to bash shell's rc file (if applicable)
echo 'export PATH="/Users/username/homebrew/bin:$PATH"' >> ~/.bashrc
# if homebrew doesn't work immediately, don't worry, you just have to source the new path
source ~/.zshrc # if you are using zsh
source ~/.bash_profile # if you are using bash
# you can test with the following
brew --version
NodeJS
NodeJS and NPM can be installed with Node Version Manager. Complete documentation can be found at https://github.com/nvm-sh/nvm, but the following is the minimum required to install and use NodeJS.
# install Node Version Manager (NVM)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# install and use the latest stable version of NodeJS
nvm install --lts
# check install
nvm --version
# if the install didn't work, you may have to add the following to ~/.zshrc or ~/.bash_profile
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Java
With homebrew installed, you can install Java with just a couple commands.
# use homebrew to install Java
brew install java
# add Java to your PATH environmental variable, so your terminal knows where to find Java
echo 'export PATH="'$(brew --prefix)'/opt/openjdk/bin:$PATH"' >> ~/.zshrc # if you are using zsh
echo 'export PATH="'$(brew --prefix)'/opt/openjdk/bin:$PATH"' >> ~/.bashrc # if you are using bashrc
echo 'export PATH="'$(brew --prefix)'/opt/openjdk/bin:$PATH"' >> ~/.bash_profile # if you are using bash_profile
# you can test that it works with the following
java --version
PostgreSQL
With homebrew installed, you can install and run PostgreSQL without EP. You can read the documentation on that approach here: https://wiki.postgresql.org/wiki/Homebrew. The code for that is below
# using homebrew, install postgresql
brew install postgresql
# run postgresql
brew services start postgresql
ElasticMQ
ElastiqMQ provides official instructions for a stand-alone installation, which you can find here: https://github.com/softwaremill/elasticmq#installation-stand-alone. Below is the key code for that:
# download/install ElasticMQ Java Archive (JAR) File
curl https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-1.3.9.jar --output elasticmq-server-1.3.9.jar
# run the ElasticMQ JAR we downloaded in the previous step
java -jar elasticmq-server-1.3.9.jar
Leiningen
With Java installed, you can install Leiningen, a tool for working with Clojure.
# as of Jan 19, 2023, the following line is required to fix the following error: "Package 'pthread-stubs', required by 'xcb', not found"
brew reinstall --build-from-source libxcb
brew install leiningen
Maven
Go
Related articles